chore: structure basic
[KDIS.git] / Tests / CMakeLists.txt
blobca48e5d1796bf3181e4d4998ed32acff93f97619
1 set(PROJECT_NAME_STR KDIS)\r
2 \r
3 find_package(Threads REQUIRED)\r
4 set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)\r
5 include(FetchContent)\r
6 FetchContent_Declare(\r
7         googletest\r
8         GIT_REPOSITORY https://github.com/google/googletest.git\r
9         GIT_TAG        703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0\r
10 )\r
11 FetchContent_MakeAvailable(googletest)\r
13 enable_testing()\r
14 set(PROJECT_TEST_NAME ${PROJECT_NAME_STR}_tests)\r
15 include_directories(${GTEST_INCLUDE_DIRS} ${COMMON_INCLUDES})\r
16 INCLUDE_DIRECTORIES(${KDIS_SOURCE_DIR})\r
17 file(GLOB TEST_SRC_FILES UnitTests/*.cpp)\r
18 add_executable(${PROJECT_TEST_NAME} ${TEST_SRC_FILES})\r
19 target_link_libraries(${PROJECT_TEST_NAME} gtest_main)\r
20 add_test(${PROJECT_TEST_NAME} ${PROJECT_TEST_NAME})\r
22 IF(BUILD_EXAMPLES_TO_LINK_TO_LIB)\r
24     IF(EXAMPLES_USE_STATIC_OR_SHARED_LIB MATCHES STATIC)\r
25         TARGET_LINK_LIBRARIES(${PROJECT_TEST_NAME} KDIS_LIB)\r
26     ENDIF(EXAMPLES_USE_STATIC_OR_SHARED_LIB MATCHES STATIC)\r
27     \r
28     IF(EXAMPLES_USE_STATIC_OR_SHARED_LIB MATCHES SHARED)\r
29         TARGET_LINK_LIBRARIES(${PROJECT_TEST_NAME} KDIS_DLL)\r
30         ADD_DEFINITIONS(-D "IMPORT_KDIS")\r
31     ENDIF(EXAMPLES_USE_STATIC_OR_SHARED_LIB MATCHES SHARED)\r
32     \r
33 ENDIF(BUILD_EXAMPLES_TO_LINK_TO_LIB)\r
35 IF(DIS_VERSION MATCHES 6)\r
36         ADD_DEFINITIONS(-D "DIS_VERSION=6")\r
37 ENDIF(DIS_VERSION MATCHES 6)\r
39 IF(DIS_VERSION MATCHES 5)\r
40         ADD_DEFINITIONS(-D "DIS_VERSION=5")\r
41 ENDIF(DIS_VERSION MATCHES 5)\r
43 IF(DIS_VERSION MATCHES 7)\r
44         ADD_DEFINITIONS(-D "DIS_VERSION=7")\r
45 ENDIF(DIS_VERSION MATCHES 7)\r
47 IF(KDIS_USE_ENUM_DESCRIPTORS)\r
48         ADD_DEFINITIONS(-D "KDIS_USE_ENUM_DESCRIPTORS")\r
49 ENDIF(KDIS_USE_ENUM_DESCRIPTORS) \r
51 #target_link_libraries(${PROJECT_TEST_NAME} ${CMAKE_THREAD_LIBS_INIT})\r