summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-09-05 18:25:27 (GMT)
committerBrad King <brad.king@kitware.com>2014-09-05 18:38:05 (GMT)
commit0f1f1271e6ddcea9074afe79685a731d4295c1f5 (patch)
tree4012664a0c9ff485740fe5bf4a5982072597f323 /Tests
parent4f7d0c421abf047c052cb8d459c8249310cf4f3a (diff)
downloadCMake-0f1f1271e6ddcea9074afe79685a731d4295c1f5.zip
CMake-0f1f1271e6ddcea9074afe79685a731d4295c1f5.tar.gz
CMake-0f1f1271e6ddcea9074afe79685a731d4295c1f5.tar.bz2
CMake: Add CMAKE_GENERATOR_PLATFORM option
Reject the option by default. It will be implemented on a per-generator basis. Pass the setting into try_compile project generation. Add cache entry CMAKE_GENERATOR_PLATFORM and associated variable documentation to hold the value persistently. Add a RunCMake.GeneratorPlatform test to cover basic use cases for the option. Verify that CMAKE_GENERATOR_PLATFORM is empty by default, and that it is rejected when the generator does not support a user setting.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadPlatform-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadPlatform-stderr.txt10
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadPlatform.cmake1
-rw-r--r--Tests/RunCMake/GeneratorPlatform/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/GeneratorPlatform/NoPlatform-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorPlatform/NoPlatform-stderr.txt4
-rw-r--r--Tests/RunCMake/GeneratorPlatform/NoPlatform.cmake7
-rw-r--r--Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake7
9 files changed, 35 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 3cd9947..d52a2b6 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -58,6 +58,7 @@ add_RunCMake_test(ExternalData)
add_RunCMake_test(FeatureSummary)
add_RunCMake_test(FPHSA)
add_RunCMake_test(GeneratorExpression)
+add_RunCMake_test(GeneratorPlatform)
add_RunCMake_test(GeneratorToolset)
add_RunCMake_test(TargetPropertyGeneratorExpressions)
add_RunCMake_test(Languages)
diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatform-result.txt b/Tests/RunCMake/GeneratorPlatform/BadPlatform-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/BadPlatform-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatform-stderr.txt b/Tests/RunCMake/GeneratorPlatform/BadPlatform-stderr.txt
new file mode 100644
index 0000000..e315714
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/BadPlatform-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ .*
+
+ does not support platform specification, but platform
+
+ Bad Platform
+
+ was specified.$
diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatform.cmake b/Tests/RunCMake/GeneratorPlatform/BadPlatform.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/BadPlatform.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt b/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt
new file mode 100644
index 0000000..12cd3c7
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/GeneratorPlatform/NoPlatform-result.txt b/Tests/RunCMake/GeneratorPlatform/NoPlatform-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/NoPlatform-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorPlatform/NoPlatform-stderr.txt b/Tests/RunCMake/GeneratorPlatform/NoPlatform-stderr.txt
new file mode 100644
index 0000000..e1c0da4
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/NoPlatform-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoPlatform.cmake:2 \(message\):
+ CMAKE_GENERATOR_PLATFORM is empty as expected.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorPlatform/NoPlatform.cmake b/Tests/RunCMake/GeneratorPlatform/NoPlatform.cmake
new file mode 100644
index 0000000..1e0ca6d
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/NoPlatform.cmake
@@ -0,0 +1,7 @@
+if("x${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x")
+ message(FATAL_ERROR "CMAKE_GENERATOR_PLATFORM is empty as expected.")
+else()
+ message(FATAL_ERROR
+ "CMAKE_GENERATOR_PLATFORM is \"${CMAKE_GENERATOR_PLATFORM}\" "
+ "but should be empty!")
+endif()
diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake
new file mode 100644
index 0000000..60217bc
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake
@@ -0,0 +1,7 @@
+include(RunCMake)
+
+run_cmake(NoPlatform)
+
+set(RunCMake_TEST_OPTIONS "-DCMAKE_GENERATOR_PLATFORM=Bad Platform")
+run_cmake(BadPlatform)
+unset(RunCMake_TEST_OPTIONS)