-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
32 lines (32 loc) · 1.19 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
get_filename_component(exercise ${CMAKE_CURRENT_SOURCE_DIR} NAME)
cmake_minimum_required(VERSION 2.8.11)
project(${exercise} CXX)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.55 REQUIRED COMPONENTS unit_test_framework date_time regex)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
set(CMAKE_CXX_FLAGS "-std=c++11")
endif()
if(${EXERCISM_RUN_ALL_TESTS})
add_definitions(-DEXERCISM_RUN_ALL_TESTS)
endif()
string(REPLACE "-" "_" file ${exercise})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.cpp)
set(exercise_cpp ${file}.cpp)
else()
set(exercise_cpp "")
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
set(test_helper require_equal_containers.h)
else()
set(test_helper "")
endif()
add_executable(${exercise} ${file}_test.cpp ${test_helper} ${exercise_cpp} ${file}.h)
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
target_link_libraries(${exercise} ${Boost_LIBRARIES})
if(${MSVC})
set_target_properties(${exercise} PROPERTIES
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
endif()
add_custom_command(TARGET ${exercise} POST_BUILD COMMAND ${exercise})