diff options
author | Craig Scott <craig.scott@crascit.com> | 2024-05-25 08:58:44 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2024-05-25 09:01:10 (GMT) |
commit | 2efceb290e78edbc208755e8f68512a4a4e96281 (patch) | |
tree | 38fae4cbd3fcffd1df242d0b1ba78a5f121f0bff /Tests/RunCMake | |
parent | 47ba19f346d03123c59ee5a3fe36d32a43b96359 (diff) | |
download | CMake-2efceb290e78edbc208755e8f68512a4a4e96281.zip CMake-2efceb290e78edbc208755e8f68512a4a4e96281.tar.gz CMake-2efceb290e78edbc208755e8f68512a4a4e96281.tar.bz2 |
FetchContent: Make FetchContent_Populate() honor CMP0168
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/FetchContent/ScriptMode.cmake | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/RunCMake/FetchContent/ScriptMode.cmake b/Tests/RunCMake/FetchContent/ScriptMode.cmake index bf66140..41b624a 100644 --- a/Tests/RunCMake/FetchContent/ScriptMode.cmake +++ b/Tests/RunCMake/FetchContent/ScriptMode.cmake @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.29) cmake_policy(SET CMP0168 ${CMP0168}) include(FetchContent) @@ -13,6 +14,11 @@ FetchContent_Populate( if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/t1-src/done1.txt) message(FATAL_ERROR "Default SOURCE_DIR doesn't contain done1.txt") endif() +if(CMP0168 STREQUAL "NEW" AND EXISTS ${CMAKE_CURRENT_BINARY_DIR}/t1-subbuild) + message(FATAL_ERROR "t1 sub-build used when expected direct population") +elseif(CMP0168 STREQUAL "OLD" AND NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/t1-subbuild) + message(FATAL_ERROR "t1 used direct population when a sub-build was expected") +endif() FetchContent_Populate( t2 @@ -24,6 +30,11 @@ FetchContent_Populate( if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mysrc/done2.txt) message(FATAL_ERROR "Specified SOURCE_DIR doesn't contain done2.txt") endif() +if(CMP0168 STREQUAL "NEW" AND EXISTS ${CMAKE_CURRENT_BINARY_DIR}/t2-subbuild) + message(FATAL_ERROR "t2 sub-build used when expected direct population") +elseif(CMP0168 STREQUAL "OLD" AND NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/t2-subbuild) + message(FATAL_ERROR "t2 used direct population when a sub-build was expected") +endif() FetchContent_Populate( t3 @@ -35,3 +46,8 @@ FetchContent_Populate( if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/myrelsrc/done3.txt) message(FATAL_ERROR "Relative SOURCE_DIR doesn't contain done3.txt") endif() +if(CMP0168 STREQUAL "NEW" AND EXISTS ${CMAKE_CURRENT_BINARY_DIR}/t3-subbuild) + message(FATAL_ERROR "t3 sub-build used when expected direct population") +elseif(CMP0168 STREQUAL "OLD" AND NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/t3-subbuild) + message(FATAL_ERROR "t3 used direct population when a sub-build was expected") +endif() |