-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
42 lines (37 loc) · 1.56 KB
/
CMakeLists.txt
File metadata and controls
42 lines (37 loc) · 1.56 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
38
39
40
41
42
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/sort)
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/sort/${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(h_index_test.cpp)
add_target_test(insertion_sort_test.cpp)
add_target_test(intersect_two_sorted_array_test.cpp)
add_target_test(merge_interval_test.cpp)
add_target_test(merge_two_sorted_array_test.cpp)
add_target_test(remove_first_name_duplicate_test.cpp)
add_target_test(selection_sort_test.cpp)
add_target_test(union_interval_test.cpp)