diff --git a/tests/cmake_fetch_content/CMakeLists.txt b/tests/cmake_fetch_content/CMakeLists.txt index 211a49cee..42fcb5816 100644 --- a/tests/cmake_fetch_content/CMakeLists.txt +++ b/tests/cmake_fetch_content/CMakeLists.txt @@ -1,21 +1,19 @@ -if (${CMAKE_VERSION} VERSION_GREATER "3.11.0") - add_test(NAME cmake_fetch_content_configure - COMMAND ${CMAKE_COMMAND} +add_test(NAME cmake_fetch_content_configure + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -Dnlohmann_json_source=${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/project - ) - add_test(NAME cmake_fetch_content_build - COMMAND ${CMAKE_COMMAND} --build . - ) - set_tests_properties(cmake_fetch_content_configure PROPERTIES - FIXTURES_SETUP cmake_fetch_content - LABELS "git_required;not_reproducible" - ) - set_tests_properties(cmake_fetch_content_build PROPERTIES - FIXTURES_REQUIRED cmake_fetch_content - LABELS "git_required;not_reproducible" - ) -endif() +) +add_test(NAME cmake_fetch_content_build + COMMAND ${CMAKE_COMMAND} --build . +) +set_tests_properties(cmake_fetch_content_configure PROPERTIES + FIXTURES_SETUP cmake_fetch_content + LABELS "git_required;not_reproducible" +) +set_tests_properties(cmake_fetch_content_build PROPERTIES + FIXTURES_REQUIRED cmake_fetch_content + LABELS "git_required;not_reproducible" +) diff --git a/tests/cmake_fetch_content/project/CMakeLists.txt b/tests/cmake_fetch_content/project/CMakeLists.txt index 9f7488157..ad8a05045 100644 --- a/tests/cmake_fetch_content/project/CMakeLists.txt +++ b/tests/cmake_fetch_content/project/CMakeLists.txt @@ -4,6 +4,14 @@ project(DummyImport CXX) include(FetchContent) +# This test deliberately covers the pre-3.14 FetchContent_Populate pattern +# (see FetchContent_MakeAvailable in ../../cmake_fetch_content2/project for +# the 3.14+ alternative), which CMake 3.30 deprecated as CMP0169. Silence the +# deprecation warning on purpose instead of switching to the new pattern. +if(POLICY CMP0169) + cmake_policy(SET CMP0169 OLD) +endif() + get_filename_component(GIT_REPOSITORY_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../.. ABSOLUTE) FetchContent_Declare(json GIT_REPOSITORY ${GIT_REPOSITORY_DIRECTORY} GIT_TAG HEAD) diff --git a/tests/cmake_fetch_content2/CMakeLists.txt b/tests/cmake_fetch_content2/CMakeLists.txt index b35f93cfd..9b24fee01 100644 --- a/tests/cmake_fetch_content2/CMakeLists.txt +++ b/tests/cmake_fetch_content2/CMakeLists.txt @@ -1,4 +1,4 @@ -if (${CMAKE_VERSION} VERSION_GREATER "3.14.0") +if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14") add_test(NAME cmake_fetch_content2_configure COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"