diff options
author | Basil Fierz <basil.fierz@hotmail.com> | 2018-05-19 11:23:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-05-29 14:12:59 (GMT) |
commit | 5f1316841944198037d6463d3ddd12efcfae45b3 (patch) | |
tree | 3a58c25a578caa6813fa66efcc18eac968991368 /Tests | |
parent | a543a233a280f23e72ce5ff7d7a00239bd8634fb (diff) | |
download | CMake-5f1316841944198037d6463d3ddd12efcfae45b3.zip CMake-5f1316841944198037d6463d3ddd12efcfae45b3.tar.gz CMake-5f1316841944198037d6463d3ddd12efcfae45b3.tar.bz2 |
VS: Add option to select the version of the toolset used by VS 2017
Add new `version=` parameter in the toolset setting to select the
version. Add variable `CMAKE_VS_PLATFORM_TOOLSET_VERSION` to hold the
version, if one is set (blank indicates default).
Fixes: #17549
Diffstat (limited to 'Tests')
11 files changed, 44 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetVersion-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetVersion-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetVersion-stderr.txt new file mode 100644 index 0000000..c976f59 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetVersion-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + given toolset and version specification + + Test Toolset,version=Bad Toolset Version + + contains an invalid version specification. diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetVersion.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetVersion.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetVersion.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice-stderr.txt new file mode 100644 index 0000000..b780dad --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + given toolset specification + + Test Toolset,version=Test Toolset Version,version=Test Toolset Version + + that contains duplicate field key 'version'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetVersionTwice.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index f89100e..d1738a0 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -25,6 +25,18 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") run_cmake(BadToolsetHostArch) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64,host=x64") run_cmake(BadToolsetHostArchTwice) + if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 15") + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,version=Test Toolset Version") + run_cmake(TestToolsetVersionBoth) + set(RunCMake_GENERATOR_TOOLSET ",version=Test Toolset Version") + run_cmake(TestToolsetVersionOnly) + set(RunCMake_GENERATOR_TOOLSET "version=Test Toolset Version") + run_cmake(TestToolsetVersionOnly) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,version=Bad Toolset Version") + run_cmake(BadToolsetVersion) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,version=Test Toolset Version,version=Test Toolset Version") + run_cmake(BadToolsetVersionTwice) + endif() else() set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(BadToolsetHostArch) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetVersionBoth-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetVersionBoth-stdout.txt new file mode 100644 index 0000000..9b91fde --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetVersionBoth-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset' +-- CMAKE_VS_PLATFORM_TOOLSET_VERSION='Test Toolset Version' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetVersionBoth.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetVersionBoth.cmake new file mode 100644 index 0000000..fbc75be --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetVersionBoth.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_VERSION='${CMAKE_VS_PLATFORM_TOOLSET_VERSION}'") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetVersionOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetVersionOnly-stdout.txt new file mode 100644 index 0000000..25c4163 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetVersionOnly-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='v[0-9]+' +-- CMAKE_VS_PLATFORM_TOOLSET_VERSION='Test Toolset Version' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetVersionOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetVersionOnly.cmake new file mode 100644 index 0000000..fbc75be --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetVersionOnly.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_VERSION='${CMAKE_VS_PLATFORM_TOOLSET_VERSION}'") |