mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
Implement generator toolset selection (cmake -T) for VS >= 10 by setting
the PlatformToolset. Extend the RunCMake.GeneratorToolset test case to
verify CMAKE_GENERATOR_TOOLSET when the generator supports -T.
Since commit 485a940e (VS: Simplify MSVC version reporting, 2012-08-23)
all MSVC version information is detected during the compiler id step
from the actual compiler invoked by generated build systems rather than
hard-coded in VS generators. Therefore we can set the PlatformToolset
in VS >= 10 project files and support toolsets from other VS versions.
18 lines
427 B
CMake
18 lines
427 B
CMake
include(RunCMake)
|
|
|
|
run_cmake(NoToolset)
|
|
|
|
if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01]")
|
|
set(RunCMake_TEST_OPTIONS -T "Test Toolset")
|
|
run_cmake(TestToolset)
|
|
unset(RunCMake_TEST_OPTIONS)
|
|
else()
|
|
set(RunCMake_TEST_OPTIONS -T "Bad Toolset")
|
|
run_cmake(BadToolset)
|
|
unset(RunCMake_TEST_OPTIONS)
|
|
endif()
|
|
|
|
set(RunCMake_TEST_OPTIONS -T "Toolset 1" "-TToolset 2")
|
|
run_cmake(TwoToolsets)
|
|
unset(RunCMake_TEST_OPTIONS)
|