xlnt/samples/CMakeLists.txt

25 lines
850 B
CMake
Raw Normal View History

2017-03-06 11:39:27 +08:00
cmake_minimum_required(VERSION 3.2)
project(xlnt.samples)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2016-10-28 06:40:20 +08:00
if(NOT COMBINED_PROJECT)
2017-03-06 11:59:55 +08:00
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../source ${CMAKE_CURRENT_BINARY_DIR}/source)
2016-10-26 08:53:11 +08:00
endif()
file(GLOB SAMPLE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(SAMPLE_SOURCE IN ITEMS ${SAMPLE_SOURCES})
get_filename_component(SAMPLE_NAME ${SAMPLE_SOURCE} NAME_WE)
set(SAMPLE_EXECUTABLE sample-${SAMPLE_NAME})
add_executable(${SAMPLE_EXECUTABLE} ${SAMPLE_SOURCE})
2017-04-12 05:49:07 +08:00
target_link_libraries(${SAMPLE_EXECUTABLE} PRIVATE xlnt)
if(NOT STATIC)
add_custom_command(TARGET ${SAMPLE_EXECUTABLE} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:xlnt>
$<TARGET_FILE_DIR:${SAMPLE_EXECUTABLE}>)
endif()
endforeach()