Tests: Test setting a generator platform in a toolchain file
Teach the RunCMake.GeneratorPlatform test to cover setting CMAKE_GENERATOR_PLATFORM in a file loaded by CMAKE_TOOLCHAIN_FILE.
This commit is contained in:
parent
d506fee81c
commit
be6a555d7e
|
@ -0,0 +1 @@
|
||||||
|
set(CMAKE_GENERATOR_PLATFORM "Bad Platform")
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,10 @@
|
||||||
|
CMake Error at CMakeLists.txt:[0-9]+ \(project\):
|
||||||
|
Generator
|
||||||
|
|
||||||
|
.*
|
||||||
|
|
||||||
|
does not support platform specification, but platform
|
||||||
|
|
||||||
|
Bad Platform
|
||||||
|
|
||||||
|
was specified.$
|
|
@ -0,0 +1 @@
|
||||||
|
message(FATAL_ERROR "This should not be reached!")
|
|
@ -16,3 +16,13 @@ set(RunCMake_GENERATOR_TOOLSET "")
|
||||||
set(RunCMake_TEST_OPTIONS -A "Extra Platform")
|
set(RunCMake_TEST_OPTIONS -A "Extra Platform")
|
||||||
run_cmake(TwoPlatforms)
|
run_cmake(TwoPlatforms)
|
||||||
unset(RunCMake_TEST_OPTIONS)
|
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()
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
set(CMAKE_GENERATOR_PLATFORM "Test Platform")
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -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\)
|
|
@ -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()
|
Loading…
Reference in New Issue