diff options
Diffstat (limited to 'Tests/RunCMake')
13 files changed, 54 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 8f09c5f..549aed8 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -4,6 +4,7 @@ macro(add_RunCMake_test test) add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} @@ -59,6 +60,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..89cc712 --- /dev/null +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -0,0 +1,12 @@ +include(RunCMake) + +set(RunCMake_GENERATOR_PLATFORM "") +run_cmake(NoPlatform) + +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[0124])( 20[0-9][0-9])?$") + set(RunCMake_GENERATOR_PLATFORM "x64") + run_cmake(x64Platform) +else() + set(RunCMake_GENERATOR_PLATFORM "Bad Platform") + run_cmake(BadPlatform) +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() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 2020356..abc3e3d 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -53,6 +53,7 @@ function(run_cmake test) execute_process( COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" -G "${RunCMake_GENERATOR}" + "-DCMAKE_GENERATOR_PLATFORM=${RunCMake_GENERATOR_PLATFORM}" -T "${RunCMake_GENERATOR_TOOLSET}" -DRunCMake_TEST=${test} --no-warn-unused-cli diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index 7f5ef53..408cadb 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -80,7 +80,9 @@ function(check_project test name guid type platform) set(type 8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942) endif() if(NOT platform) - if("${RunCMake_GENERATOR}" MATCHES "Win64") + if(RunCMake_GENERATOR_PLATFORM) + set(platform "${RunCMake_GENERATOR_PLATFORM}") + elseif("${RunCMake_GENERATOR}" MATCHES "Win64") set(platform "x64") else() set(platform "Win32") |