diff options
author | Brad King <brad.king@kitware.com> | 2014-09-05 18:53:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-09-05 19:03:56 (GMT) |
commit | b97736a23d5d83eb65b6ee0b0429ada9fb331c12 (patch) | |
tree | 5aaf927d1c3e6fe42c60a6321ab5cf573d568a08 /Tests/RunCMake | |
parent | 0f1f1271e6ddcea9074afe79685a731d4295c1f5 (diff) | |
download | CMake-b97736a23d5d83eb65b6ee0b0429ada9fb331c12.zip CMake-b97736a23d5d83eb65b6ee0b0429ada9fb331c12.tar.gz CMake-b97736a23d5d83eb65b6ee0b0429ada9fb331c12.tar.bz2 |
VS: Implement CMAKE_GENERATOR_PLATFORM for VS >= 8
For VS generator names that do not specify the platform name, read
CMAKE_GENERATOR_PLATFORM to get it.
Extend the RunCMake.GeneratorPlatform test with a case covering
use of the x64 platform when the test generator is a Visual Studio
generator whose name does not specify a platform.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorPlatform/x64Platform.cmake | 7 |
3 files changed, 18 insertions, 3 deletions
diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake index 60217bc..442eb9f 100644 --- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -2,6 +2,12 @@ include(RunCMake) run_cmake(NoPlatform) -set(RunCMake_TEST_OPTIONS "-DCMAKE_GENERATOR_PLATFORM=Bad Platform") -run_cmake(BadPlatform) -unset(RunCMake_TEST_OPTIONS) +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[0124])( 20[0-9][0-9])?$") + set(RunCMake_TEST_OPTIONS "-DCMAKE_GENERATOR_PLATFORM=x64") + run_cmake(x64Platform) + unset(RunCMake_TEST_OPTIONS) +else() + set(RunCMake_TEST_OPTIONS "-DCMAKE_GENERATOR_PLATFORM=Bad Platform") + run_cmake(BadPlatform) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt b/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt new file mode 100644 index 0000000..05a83ff --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/x64Platform-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_GENERATOR_PLATFORM is 'x64' as expected. +-- CMAKE_VS_PLATFORM_NAME is 'x64' as expected. diff --git a/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake b/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake new file mode 100644 index 0000000..a23bdc7 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/x64Platform.cmake @@ -0,0 +1,7 @@ +foreach(v CMAKE_GENERATOR_PLATFORM CMAKE_VS_PLATFORM_NAME) + if("x${${v}}" STREQUAL "xx64") + message(STATUS "${v} is 'x64' as expected.") + else() + message(FATAL_ERROR "${v} is '${${v}}' but should be 'x64'!") + endif() +endforeach() |