@@ -4,14 +4,17 @@ endif()
44
55if (CMAKE_VERSION GREATER_EQUAL 3.11)
66 include (FetchContent)
7- FetchContent_Declare(doctest GIT_REPOSITORY https://github.com/doctest/doctest.git GIT_TAG v2.4.11)
8- FetchContent_GetProperties(doctest)
9- if (NOT doctest_POPULATED)
10- set (DOCTEST_NO_INSTALL TRUE )
11- FetchContent_Populate(doctest)
12- add_subdirectory ("${doctest_SOURCE_DIR} " "${doctest_BINARY_DIR} " )
7+ FetchContent_Declare(doctest GIT_REPOSITORY https://github.com/doctest/doctest.git GIT_TAG dev GIT_PROGRESS TRUE CMAKE_ARGS DOCTEST_NO_INSTALL=TRUE )
8+ if (CMAKE_VERSION GREATER_EQUAL 3.14)
9+ FetchContent_MakeAvailable(doctest)
1310 include ("${doctest_SOURCE_DIR} /scripts/cmake/doctest.cmake" )
14- unset (DOCTEST_NO_INSTALL)
11+ else ()
12+ FetchContent_GetProperties(doctest)
13+ if (NOT doctest_POPULATED)
14+ FetchContent_Populate(doctest)
15+ add_subdirectory ("${doctest_SOURCE_DIR} " "${doctest_BINARY_DIR} " )
16+ include ("${doctest_SOURCE_DIR} /scripts/cmake/doctest.cmake" )
17+ endif ()
1518 endif ()
1619else ()
1720 find_package (doctest QUIET )
@@ -26,7 +29,7 @@ endif()
2629function (cppterminal_test )
2730 cmake_parse_arguments (ARG "" "SOURCE" "" ${ARGN} )
2831 add_executable ("${ARG_SOURCE} .test" "${ARG_SOURCE} .test.cpp" )
29- target_link_libraries ("${ARG_SOURCE} .test" PRIVATE doctest::doctest cpp-terminal::cpp-terminal)
32+ target_link_libraries ("${ARG_SOURCE} .test" PRIVATE cpp-terminal::cpp-terminal doctest::doctest )
3033 doctest_discover_tests("${ARG_SOURCE} .test" )
3134endfunction ()
3235
@@ -42,5 +45,5 @@ cppterminal_test(SOURCE version)
4245if (NOT MINGW AND NOT MSYS)
4346add_executable (Args args.test .cpp)
4447target_link_libraries (Args PRIVATE doctest::doctest cpp-terminal::cpp-terminal)
45- doctest_discover_tests(Args EXTRA_ARGS Bonjour Hello 你好 )
48+ doctest_discover_tests(Args EXTRA_ARGS Bonjour Hello 大家好 )
4649endif ()
0 commit comments