summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-09-12 09:55:06 -0400
committerBrad King <brad.king@kitware.com>2014-09-15 10:26:59 -0400
commiteb7d8156492c353f9972bdf6e2203657f5d6592e (patch)
tree30eb3dcc6a09032e14044b6866929f86f6ad5093 /Tests
parent09c8ad99433df06ed36791bfaef97996cd2de04e (diff)
downloadcmake-eb7d8156492c353f9972bdf6e2203657f5d6592e.tar.gz
cmake: Add -A option to specify a generator platform
Define the 'cmake -A' option to set CMAKE_GENERATOR_PLATFORM without having to spell out the whole variable name. We choose the name '-A' for "platform" because '-P' is already taken, and in the common use case the "platform" is actually an architecture (e.g. x64). Teach the RunCMake test infrastructure to use -A to pass the generator platform. Extend the RunCMake.GeneratorPlatform test with a case to verify that the -A option cannot be repeated.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorPlatform/TwoPlatforms-stderr.txt1
-rw-r--r--Tests/RunCMake/GeneratorPlatform/TwoPlatforms.cmake1
-rw-r--r--Tests/RunCMake/RunCMake.cmake2
5 files changed, 10 insertions, 1 deletions
diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake
index 89cc712d08..76045f0ccd 100644
--- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake
@@ -10,3 +10,9 @@ else()
set(RunCMake_GENERATOR_PLATFORM "Bad Platform")
run_cmake(BadPlatform)
endif()
+
+set(RunCMake_GENERATOR_TOOLSET "")
+
+set(RunCMake_TEST_OPTIONS -A "Extra Platform")
+run_cmake(TwoPlatforms)
+unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-stderr.txt b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-stderr.txt
new file mode 100644
index 0000000000..90e4ecad8d
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Multiple -A options not allowed
diff --git a/Tests/RunCMake/GeneratorPlatform/TwoPlatforms.cmake b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms.cmake
new file mode 100644
index 0000000000..2fc38e5c59
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index abc3e3ddd4..56d69c846b 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -53,7 +53,7 @@ function(run_cmake test)
execute_process(
COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}"
-G "${RunCMake_GENERATOR}"
- "-DCMAKE_GENERATOR_PLATFORM=${RunCMake_GENERATOR_PLATFORM}"
+ -A "${RunCMake_GENERATOR_PLATFORM}"
-T "${RunCMake_GENERATOR_TOOLSET}"
-DRunCMake_TEST=${test}
--no-warn-unused-cli