diff options
author | Brad King <brad.king@kitware.com> | 2014-09-15 14:27:38 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-09-15 14:27:38 (GMT) |
commit | b234836637d97b2d9cc837829c485ec87e64c5ce (patch) | |
tree | 294c854c5146ac45b5598f7220c36a4a4c7b8b6e /Tests/RunCMake | |
parent | 9edf6903e62f84a567db3938bb8fec3f19789545 (diff) | |
parent | be6a555d7ec9348575e3431bd6709f48dc959100 (diff) | |
download | CMake-b234836637d97b2d9cc837829c485ec87e64c5ce.zip CMake-b234836637d97b2d9cc837829c485ec87e64c5ce.tar.gz CMake-b234836637d97b2d9cc837829c485ec87e64c5ce.tar.bz2 |
Merge topic 'vs-generator-platform'
be6a555d Tests: Test setting a generator platform in a toolchain file
d506fee8 Tests: Use -A option to pass generator platform selection
11c9ddd6 ExternalProject: Use -A option to pass generator platform
29bd843e CTest: Use -A option to pass generator platform selection
eb7d8156 cmake: Add -A option to specify a generator platform
Diffstat (limited to 'Tests/RunCMake')
13 files changed, 60 insertions, 1 deletions
diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatform-toolchain.cmake b/Tests/RunCMake/GeneratorPlatform/BadPlatform-toolchain.cmake new file mode 100644 index 0000000..1c544b0 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatform-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_PLATFORM "Bad Platform") diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-result.txt b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-stderr.txt b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-stderr.txt new file mode 100644 index 0000000..e315714 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain-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/BadPlatformToolchain.cmake b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/BadPlatformToolchain.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake index 89cc712..4d0a0a1 100644 --- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -10,3 +10,19 @@ 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) + +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[0124])( 20[0-9][0-9])?$") + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestPlatform-toolchain.cmake) + run_cmake(TestPlatformToolchain) + unset(RunCMake_TEST_OPTIONS) +else() + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/BadPlatform-toolchain.cmake) + run_cmake(BadPlatformToolchain) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake b/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake new file mode 100644 index 0000000..763478c --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_PLATFORM "Test Platform") diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-result.txt b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt new file mode 100644 index 0000000..b9bb3b2 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TestPlatformToolchain.cmake:[0-9]+ \(message\): + CMAKE_GENERATOR_PLATFORM is "Test Platform" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at TestPlatformToolchain.cmake:[0-9]+ \(message\): + CMAKE_VS_PLATFORM_NAME is "Test Platform" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain.cmake b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain.cmake new file mode 100644 index 0000000..c4430a5 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain.cmake @@ -0,0 +1,16 @@ +if("x${CMAKE_GENERATOR_PLATFORM}" STREQUAL "xTest Platform") + message(SEND_ERROR "CMAKE_GENERATOR_PLATFORM is \"Test Platform\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_PLATFORM is \"${CMAKE_GENERATOR_PLATFORM}\" " + "but should be \"Test Platform\"!") +endif() +if(CMAKE_GENERATOR MATCHES "Visual Studio") + if("x${CMAKE_VS_PLATFORM_NAME}" STREQUAL "xTest Platform") + message(SEND_ERROR "CMAKE_VS_PLATFORM_NAME is \"Test Platform\" as expected.") + else() + message(FATAL_ERROR + "CMAKE_VS_PLATFORM_NAME is \"${CMAKE_VS_PLATFORM_NAME}\" " + "but should be \"Test Platform\"!") + endif() +endif() diff --git a/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt b/Tests/RunCMake/GeneratorPlatform/TwoPlatforms-result.txt new file mode 100644 index 0000000..d00491f --- /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 0000000..90e4eca --- /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 0000000..2fc38e5 --- /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 abc3e3d..56d69c8 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 |