summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeOnly
diff options
context:
space:
mode:
authorDeniz Bahadir <dbahadir@benocs.com>2019-10-18 10:51:26 (GMT)
committerBrad King <brad.king@kitware.com>2019-10-18 18:44:24 (GMT)
commitf7acc1266c64be58793cf926b41f0d58b5a55e2a (patch)
treeb3931ee79ad4debbf5cd16112edb6accfa8ab162 /Tests/CMakeOnly
parent154aa87ca6bd906b6422ad81f51161995c89cc14 (diff)
downloadCMake-f7acc1266c64be58793cf926b41f0d58b5a55e2a.zip
CMake-f7acc1266c64be58793cf926b41f0d58b5a55e2a.tar.gz
CMake-f7acc1266c64be58793cf926b41f0d58b5a55e2a.tar.bz2
project: Add variable CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE
Follow up commit 0761186949 (project: Add variable CMAKE_PROJECT_INCLUDE_BEFORE, 2019-03-28, v3.15.0-rc1~294^2) with a project-specific variant. This variable will be used similar to the already existing `CMAKE_PROJECT_INCLUDE_BEFORE` and `CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE` variables. Fixes: #19854
Diffstat (limited to 'Tests/CMakeOnly')
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt6
-rw-r--r--Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt5
-rw-r--r--Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake9
3 files changed, 20 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index 03babd2..85b9694 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -75,6 +75,12 @@ add_test(CMakeOnly.ProjectIncludeAny ${CMAKE_CMAKE_COMMAND}
add_test(CMakeOnly.ProjectIncludeBefore ${CMAKE_CMAKE_COMMAND}
-DTEST=ProjectIncludeBefore
+ -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake
+ -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake
+ )
+
+add_test(CMakeOnly.ProjectIncludeBeforeAny ${CMAKE_CMAKE_COMMAND}
+ -DTEST=ProjectIncludeBeforeAny
-DCMAKE_ARGS=-DCMAKE_PROJECT_INCLUDE_BEFORE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectIncludeBefore/include.cmake
-P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake
)
diff --git a/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt b/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt
new file mode 100644
index 0000000..5cd9cba
--- /dev/null
+++ b/Tests/CMakeOnly/ProjectIncludeBeforeAny/CMakeLists.txt
@@ -0,0 +1,5 @@
+set(FOO TRUE)
+project(ProjectInclude LANGUAGES NONE)
+if(NOT AUTO_INCLUDE)
+ message(FATAL_ERROR "include file not found")
+endif()
diff --git a/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake b/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake
new file mode 100644
index 0000000..0a4799d
--- /dev/null
+++ b/Tests/CMakeOnly/ProjectIncludeBeforeAny/include.cmake
@@ -0,0 +1,9 @@
+if(NOT FOO)
+ message(FATAL_ERROR "FOO is not set")
+endif()
+
+if(NOT "${PROJECT_NAME}" STREQUAL "")
+ message(FATAL_ERROR "PROJECT_NAME should be empty")
+endif()
+
+set(AUTO_INCLUDE TRUE)