diff options
Diffstat (limited to 'Tests/RunCMake')
16 files changed, 73 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e55cf69..320ebcc 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -39,15 +39,22 @@ macro(add_RunCMake_test test) add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR} + -DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} + ${${test}_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" ) endmacro() +if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) + set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) +endif() + add_RunCMake_test(CMP0019) add_RunCMake_test(ExternalData) add_RunCMake_test(GeneratorExpression) +add_RunCMake_test(GeneratorToolset) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolset-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt new file mode 100644 index 0000000..bf1f190 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolset-stderr.txt @@ -0,0 +1,10 @@ +CMake Error: + Generator + + .* + + does not support toolset specification, but toolset + + Bad Toolset + + was specified.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolset.cmake b/Tests/RunCMake/GeneratorToolset/BadToolset.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolset.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/CMakeLists.txt b/Tests/RunCMake/GeneratorToolset/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorToolset/NoToolset-result.txt b/Tests/RunCMake/GeneratorToolset/NoToolset-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/NoToolset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/NoToolset-stderr.txt b/Tests/RunCMake/GeneratorToolset/NoToolset-stderr.txt new file mode 100644 index 0000000..bc6f741 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/NoToolset-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoToolset.cmake:2 \(message\): + CMAKE_GENERATOR_TOOLSET is empty as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorToolset/NoToolset.cmake b/Tests/RunCMake/GeneratorToolset/NoToolset.cmake new file mode 100644 index 0000000..f1f1ecd --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/NoToolset.cmake @@ -0,0 +1,7 @@ +if("x${CMAKE_GENERATOR_TOOLSET}" STREQUAL "x") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is empty as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be empty!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake new file mode 100644 index 0000000..09375d9 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +set(RunCMake_GENERATOR_TOOLSET "") +run_cmake(NoToolset) + +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01]|Xcode" AND NOT XCODE_BELOW_3) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolset) +else() + set(RunCMake_GENERATOR_TOOLSET "Bad Toolset") + run_cmake(BadToolset) +endif() + +set(RunCMake_GENERATOR_TOOLSET "") +set(RunCMake_TEST_OPTIONS -T "Extra Toolset") +run_cmake(TwoToolsets) +unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolset-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolset-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolset-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolset-stderr.txt new file mode 100644 index 0000000..d5726af --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolset-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at TestToolset.cmake:2 \(message\): + CMAKE_GENERATOR_TOOLSET is "Test Toolset" as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolset.cmake b/Tests/RunCMake/GeneratorToolset/TestToolset.cmake new file mode 100644 index 0000000..6f83bef --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolset.cmake @@ -0,0 +1,7 @@ +if("x${CMAKE_GENERATOR_TOOLSET}" STREQUAL "xTest Toolset") + message(FATAL_ERROR "CMAKE_GENERATOR_TOOLSET is \"Test Toolset\" as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\" " + "but should be \"Test Toolset\"!") +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TwoToolsets-result.txt b/Tests/RunCMake/GeneratorToolset/TwoToolsets-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TwoToolsets-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TwoToolsets-stderr.txt b/Tests/RunCMake/GeneratorToolset/TwoToolsets-stderr.txt new file mode 100644 index 0000000..9fa817f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TwoToolsets-stderr.txt @@ -0,0 +1 @@ +CMake Error: Multiple -T options not allowed diff --git a/Tests/RunCMake/GeneratorToolset/TwoToolsets.cmake b/Tests/RunCMake/GeneratorToolset/TwoToolsets.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TwoToolsets.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 c3c161a..40b98d4 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -29,9 +29,15 @@ function(run_cmake test) set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + if(NOT DEFINED RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS "") + endif() execute_process( COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" - -G "${RunCMake_GENERATOR}" -DRunCMake_TEST=${test} + -G "${RunCMake_GENERATOR}" + -T "${RunCMake_GENERATOR_TOOLSET}" + -DRunCMake_TEST=${test} + ${RunCMake_TEST_OPTIONS} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" OUTPUT_VARIABLE actual_stdout ERROR_VARIABLE actual_stderr |