chore: fix clang-format and all cmake bool options set to true/false
[KDIS.git] / tests / CMakeLists.txt
blob876fa581d61dab60218ecf35cd4c6ce8126f1472
2 # Sources
4 set(KDIS_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
5 set(KDIS_TESTS_SOURCES
6     ${KDIS_TESTS_DIR}/ConversionTests.cpp
7     ${KDIS_TESTS_DIR}/DataType_EncodeDecode5.cpp
8     ${KDIS_TESTS_DIR}/DataType_EncodeDecode6.cpp
9     ${KDIS_TESTS_DIR}/DataType_EncodeDecode7.cpp
10     ${KDIS_TESTS_DIR}/PDU_EncodeDecode5.cpp
11     ${KDIS_TESTS_DIR}/PDU_EncodeDecode6.cpp
12     ${KDIS_TESTS_DIR}/PDU_EncodeDecode7.cpp
13     ${KDIS_TESTS_DIR}/PDU_Factory.cpp
14     ${KDIS_TESTS_DIR}/PDU_FactoryDecoder5.cpp
15     ${KDIS_TESTS_DIR}/PDU_ProtocolFamily5.cpp
16     ${KDIS_TESTS_DIR}/PDU_ProtocolFamily6.cpp
17     ${KDIS_TESTS_DIR}/PDU_ProtocolFamily7.cpp
21 # GoogleTest
23 CPMAddPackage(
24   NAME googletest
25   GITHUB_REPOSITORY google/googletest
26   GIT_TAG v1.12.0
27   EXCLUDE_FROM_ALL TRUE
28   SYSTEM TRUE
29   OPTIONS "INSTALL_GTEST OFF" "gtest_force_shared_crt ON"
31 include(GoogleTest)
34 # Test
36 enable_testing()
37 add_executable(${PROJECT_NAME}_tests ${KDIS_TESTS_SOURCES})
38 target_link_libraries(${PROJECT_NAME}_tests PRIVATE GTest::gtest_main KDIS::KDIS)
39 target_compile_definitions(
40   ${PROJECT_NAME}_tests PRIVATE DIS_VERSION=${DIS_VERSION}
41                                 $<$<BOOL:${KDIS_USE_ENUM_DESCRIPTORS}>:KDIS_USE_ENUM_DESCRIPTORS>
43 # TODO target_compile_options(${PROJECT_NAME}_tests PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
44 # $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror> )
45 gtest_discover_tests(${PROJECT_NAME}_tests)