@@ -40,37 +40,6 @@ FetchContent_Declare(
4040FetchContent_MakeAvailable (doctest)
4141include (${doctest_SOURCE_DIR } /scripts/cmake/doctest.cmake )
4242
43- ############################################
44- # configure C++ standard for unit test #
45- ############################################
46-
47- # determine C++ standard used in unit test app.
48- if ("${FK_YAML_TEST_TARGET_CXX_STANDARD} " STREQUAL "" )
49- # Apply minimum required C++ standard checked by default.
50- set (FK_YAML_TEST_TARGET_CXX_STANDARD 11)
51- endif ()
52-
53- # detect C++ standards supported by the compiler.
54- foreach (feature ${CMAKE_CXX_COMPILE_FEATURES } )
55- if (${feature} STREQUAL cxx_std_11)
56- set (FK_YAML_COMPILER_SUPPORTS_CXX_11 ON )
57- elseif (${feature} STREQUAL cxx_std_14)
58- set (FK_YAML_COMPILER_SUPPORTS_CXX_14 ON )
59- elseif (${feature} STREQUAL cxx_std_17)
60- set (FK_YAML_COMPILER_SUPPORTS_CXX_17 ON )
61- elseif (${feature} STREQUAL cxx_std_20)
62- set (FK_YAML_COMPILER_SUPPORTS_CXX_20 ON )
63- elseif (${feature} STREQUAL cxx_std_23)
64- set (FK_YAML_COMPILER_SUPPORTS_CXX_23 ON )
65- endif ()
66- endforeach ()
67-
68- # check if the determined C++ standard is supported by the compiler.
69- if (NOT FK_YAML_COMPILER_SUPPORTS_CXX_${FK_YAML_TEST_TARGET_CXX_STANDARD} )
70- message (WARNING "The target compiler does not support C++${FK_YAML_TEST_TARGET_CXX_STANDARD} . Stop configuring unit test app." )
71- return ()
72- endif ()
73-
7443######################################
7544# Prepare to use test data files #
7645######################################
@@ -94,26 +63,6 @@ target_include_directories(
9463 "${CMAKE_CURRENT_BINARY_DIR } /include"
9564 "${doctest_SOURCE_DIR } "
9665)
97- target_link_libraries (
98- unit_test_config
99- INTERFACE
100- ${FK_YAML_TARGET_NAME}
101- )
102- target_compile_features (
103- unit_test_config
104- INTERFACE
105- cxx_std_${FK_YAML_TEST_TARGET_CXX_STANDARD}
106- )
107- set_target_properties (
108- unit_test_config
109- PROPERTIES
110- CXX_EXTENTIONS OFF
111- )
112- target_compile_definitions (
113- unit_test_config
114- INTERFACE
115- $<$<CONFIG :Release >:NDEBUG >
116- )
11766
11867# Configure compile options according to the target compiler.
11968target_compile_options (
@@ -266,7 +215,12 @@ add_executable(
266215 main.cpp
267216)
268217
269- target_link_libraries (${TEST_TARGET} PRIVATE unit_test_config )
218+ target_link_libraries (
219+ ${TEST_TARGET}
220+ PRIVATE
221+ common_test_config
222+ unit_test_config
223+ )
270224
271225doctest_discover_tests (${TEST_TARGET} )
272226
0 commit comments