diff options
author | Craig Scott <craig.scott@crascit.com> | 2024-10-06 08:59:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-10-08 14:07:11 (GMT) |
commit | e5a9ccbcc88ab252cf75f005227cdeb808299266 (patch) | |
tree | 6b65eda6b71eead00d56875a3681913c2dbeb15d /Tests/RunCMake | |
parent | ddf1d2944fe53b0fb0be79621c53d2d235fce07b (diff) | |
download | CMake-e5a9ccbcc88ab252cf75f005227cdeb808299266.zip CMake-e5a9ccbcc88ab252cf75f005227cdeb808299266.tar.gz CMake-e5a9ccbcc88ab252cf75f005227cdeb808299266.tar.bz2 |
project: Always set <PROJECT-NAME>_* as normal variables
Re-introduce the behavior originally introduced in CMake 3.30.3 by
commit c1ece78d11 (project: non cache <project> prefix variables are
also created, 2024-08-27, v3.30.3~2^2), but this time with a policy for
compatibility.
Issue: #25714
Issue: #26243
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/project/CMP0180-NEW-stdout.txt | 16 | ||||
-rw-r--r-- | Tests/RunCMake/project/CMP0180-NEW.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/project/CMP0180-OLD-stdout.txt | 16 | ||||
-rw-r--r-- | Tests/RunCMake/project/CMP0180-OLD.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/project/CMP0180.cmake (renamed from Tests/RunCMake/project/SameProjectVarsSubdir.cmake) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/project/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/project/RunCMakeTest.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/project/SameProjectVarsSubdir-stdout.txt | 9 | ||||
-rw-r--r-- | Tests/RunCMake/project/subdir1/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/RunCMake/project/subdir2/CMakeLists.txt | 1 |
10 files changed, 56 insertions, 11 deletions
diff --git a/Tests/RunCMake/project/CMP0180-NEW-stdout.txt b/Tests/RunCMake/project/CMP0180-NEW-stdout.txt new file mode 100644 index 0000000..34e5d49 --- /dev/null +++ b/Tests/RunCMake/project/CMP0180-NEW-stdout.txt @@ -0,0 +1,16 @@ +(-- )?From subdir1: + CMP0180-NEW_SOURCE_DIR = [^ +]+/project/subdir1 + CMP0180-NEW_BINARY_DIR = [^ +]+/project/CMP0180-NEW-build/subdir1 + CMP0180-NEW_IS_TOP_LEVEL = OFF +(-- )?From subdir2: + CMP0180-NEW_SOURCE_DIR = [^ +]+/project + CMP0180-NEW_BINARY_DIR = [^ +]+/project/CMP0180-NEW-build + CMP0180-NEW_IS_TOP_LEVEL = ON +(-- )? sub2proj_SOURCE_DIR = [^ +]+/project/subdir2 + sub2proj_BINARY_DIR = [^ +]+/project/CMP0180-NEW-build/subdir2 diff --git a/Tests/RunCMake/project/CMP0180-NEW.cmake b/Tests/RunCMake/project/CMP0180-NEW.cmake new file mode 100644 index 0000000..71f8b84 --- /dev/null +++ b/Tests/RunCMake/project/CMP0180-NEW.cmake @@ -0,0 +1,2 @@ +# CMP0180 is handled in CMakeLists.txt +include(CMP0180.cmake) diff --git a/Tests/RunCMake/project/CMP0180-OLD-stdout.txt b/Tests/RunCMake/project/CMP0180-OLD-stdout.txt new file mode 100644 index 0000000..4ef55a4 --- /dev/null +++ b/Tests/RunCMake/project/CMP0180-OLD-stdout.txt @@ -0,0 +1,16 @@ +(-- )?From subdir1: + CMP0180-OLD_SOURCE_DIR = [^ +]+/project/subdir1 + CMP0180-OLD_BINARY_DIR = [^ +]+/project/CMP0180-OLD-build/subdir1 + CMP0180-OLD_IS_TOP_LEVEL = OFF +(-- )?From subdir2: + CMP0180-OLD_SOURCE_DIR = [^ +]+/project/subdir1 + CMP0180-OLD_BINARY_DIR = [^ +]+/project/CMP0180-OLD-build/subdir1 + CMP0180-OLD_IS_TOP_LEVEL = OFF +(-- )? sub2proj_SOURCE_DIR = [^ +]+/project/subdir2 + sub2proj_BINARY_DIR = [^ +]+/project/CMP0180-OLD-build/subdir2 diff --git a/Tests/RunCMake/project/CMP0180-OLD.cmake b/Tests/RunCMake/project/CMP0180-OLD.cmake new file mode 100644 index 0000000..71f8b84 --- /dev/null +++ b/Tests/RunCMake/project/CMP0180-OLD.cmake @@ -0,0 +1,2 @@ +# CMP0180 is handled in CMakeLists.txt +include(CMP0180.cmake) diff --git a/Tests/RunCMake/project/SameProjectVarsSubdir.cmake b/Tests/RunCMake/project/CMP0180.cmake index 36a7960..36a7960 100644 --- a/Tests/RunCMake/project/SameProjectVarsSubdir.cmake +++ b/Tests/RunCMake/project/CMP0180.cmake diff --git a/Tests/RunCMake/project/CMakeLists.txt b/Tests/RunCMake/project/CMakeLists.txt index 7ddd81d..28146c4 100644 --- a/Tests/RunCMake/project/CMakeLists.txt +++ b/Tests/RunCMake/project/CMakeLists.txt @@ -4,6 +4,12 @@ elseif(RunCMake_TEST MATCHES "^CMP0048") cmake_minimum_required(VERSION 2.8.12) # old enough to not set CMP0048 else() cmake_minimum_required(VERSION 3.10) + # CMP0180 needs to be set before the project() call for these tests + if("x${RunCMake_TEST}" STREQUAL "xCMP0180-NEW") + cmake_policy(SET CMP0180 NEW) + elseif("x${RunCMake_TEST}" STREQUAL "xCMP0180-OLD") + cmake_policy(SET CMP0180 OLD) + endif() endif() project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index ed4b8ba..554cdff 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -63,9 +63,13 @@ run_cmake(CMP0096-OLD) run_cmake(CMP0096-NEW) # We deliberately run these twice to verify behavior of the second CMake run -run_cmake(SameProjectVarsSubdir) +run_cmake(CMP0180-OLD) set(RunCMake_TEST_NO_CLEAN 1) -run_cmake(SameProjectVarsSubdir) +run_cmake(CMP0180-OLD) +set(RunCMake_TEST_NO_CLEAN 0) +run_cmake(CMP0180-NEW) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake(CMP0180-NEW) set(RunCMake_TEST_NO_CLEAN 0) run_cmake(NoMinimumRequired) diff --git a/Tests/RunCMake/project/SameProjectVarsSubdir-stdout.txt b/Tests/RunCMake/project/SameProjectVarsSubdir-stdout.txt deleted file mode 100644 index 73dadfd..0000000 --- a/Tests/RunCMake/project/SameProjectVarsSubdir-stdout.txt +++ /dev/null @@ -1,9 +0,0 @@ -(-- )? SameProjectVarsSubdir_SOURCE_DIR = [^ -]+/subdir1 - SameProjectVarsSubdir_BINARY_DIR = [^ -]+/subdir1 - SameProjectVarsSubdir_IS_TOP_LEVEL = OFF -(-- )? sub2proj_SOURCE_DIR = [^ -]+/subdir2 - sub2proj_BINARY_DIR = [^ -]+/subdir2 diff --git a/Tests/RunCMake/project/subdir1/CMakeLists.txt b/Tests/RunCMake/project/subdir1/CMakeLists.txt index d6be229..d2d3729 100644 --- a/Tests/RunCMake/project/subdir1/CMakeLists.txt +++ b/Tests/RunCMake/project/subdir1/CMakeLists.txt @@ -1 +1,8 @@ project(${RunCMake_TEST} LANGUAGES NONE) + +message(STATUS + "From subdir1:\n" + " ${RunCMake_TEST}_SOURCE_DIR = ${${RunCMake_TEST}_SOURCE_DIR}\n" + " ${RunCMake_TEST}_BINARY_DIR = ${${RunCMake_TEST}_BINARY_DIR}\n" + " ${RunCMake_TEST}_IS_TOP_LEVEL = ${${RunCMake_TEST}_IS_TOP_LEVEL}" +) diff --git a/Tests/RunCMake/project/subdir2/CMakeLists.txt b/Tests/RunCMake/project/subdir2/CMakeLists.txt index c28e0c9..cab547f 100644 --- a/Tests/RunCMake/project/subdir2/CMakeLists.txt +++ b/Tests/RunCMake/project/subdir2/CMakeLists.txt @@ -1,4 +1,5 @@ message(STATUS + "From subdir2:\n" " ${RunCMake_TEST}_SOURCE_DIR = ${${RunCMake_TEST}_SOURCE_DIR}\n" " ${RunCMake_TEST}_BINARY_DIR = ${${RunCMake_TEST}_BINARY_DIR}\n" " ${RunCMake_TEST}_IS_TOP_LEVEL = ${${RunCMake_TEST}_IS_TOP_LEVEL}" |