-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
37 lines (32 loc) · 1.34 KB
/
CMakeLists.txt
File metadata and controls
37 lines (32 loc) · 1.34 KB
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
33
34
35
36
37
find_package(GTest REQUIRED)
if(WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif(WIN32)
include_directories(${CMAKE_SOURCE_DIR}/src/include)
include_directories(${CMAKE_SOURCE_DIR}/src/math)
macro(add_target_test target)
string(REPLACE ".cpp" "" target_name ${target})
string(REPLACE "_test.cpp" "" source_name ${target})
add_executable(${target_name} ${target} "${CMAKE_SOURCE_DIR}/src/math/${source_name}.cpp")
target_link_libraries(${target_name} PRIVATE GTest::gtest_main ${ARGN})
if(MSVC)
### Edit and Continue for CMake projects
target_compile_options(${target_name} PUBLIC "/Zi")
target_link_options(${target_name} PUBLIC "/INCREMENTAL")
endif()
gtest_discover_tests(${target_name})
endmacro()
macro(add_target_header_test target)
string(REPLACE ".cpp" "" target_name ${target})
add_executable(${target_name} ${target})
target_link_libraries(${target_name} PRIVATE GTest::gtest_main ${ARGN})
if(MSVC)
### Edit and Continue for CMake projects
target_compile_options(${target_name} PUBLIC "/Zi")
target_link_options(${target_name} PUBLIC "/INCREMENTAL")
endif()
gtest_discover_tests(${target_name})
endmacro()
add_target_test(combination_test.cpp sequence_util)
add_target_test(miller_rabin_test.cpp)
add_target_test(permutation_test.cpp)