diff options
author | Brad King <brad.king@kitware.com> | 2019-04-19 11:40:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-04-19 11:46:13 (GMT) |
commit | db02be85a0bcccb633b31f087cde96d95fd21e8f (patch) | |
tree | 9814a9faa000bc83770dac6593a4b9fed890e3eb /Tests/RunCMake/GeneratorPlatform | |
parent | 5e98111643e22ad515afa2bf48a92573b6987115 (diff) | |
download | CMake-db02be85a0bcccb633b31f087cde96d95fd21e8f.zip CMake-db02be85a0bcccb633b31f087cde96d95fd21e8f.tar.gz CMake-db02be85a0bcccb633b31f087cde96d95fd21e8f.tar.bz2 |
VS: Provide the default platform name to project code
The value of `CMAKE_VS_PLATFORM_NAME` is computed by Visual Studio
generators based on `CMAKE_GENERATOR_PLATFORM` or some default.
Prior to the VS 2019 generator, the default was always `Win32`.
However, for the `Visual Studio 16 2019` generator, the default is
based on the host platform.
Store the default in a new `CMAKE_VS_PLATFORM_NAME_DEFAULT` variable for
use by project code. This is particularly useful in toolchain files
because they are allowed to set `CMAKE_GENERATOR_PLATFORM` and so
`CMAKE_VS_PLATFORM_NAME` is not yet known. Of course the toolchain file
author knows whether it will set `CMAKE_GENERATOR_PLATFORM`, and if not
then `CMAKE_VS_PLATFORM_NAME_DEFAULT` provides the platform name that
will be used.
Fixes: #19177
Diffstat (limited to 'Tests/RunCMake/GeneratorPlatform')
-rw-r--r-- | Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake b/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake index 763478c..d8138b8 100644 --- a/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatform-toolchain.cmake @@ -1 +1,2 @@ +message("CMAKE_VS_PLATFORM_NAME_DEFAULT is \"${CMAKE_VS_PLATFORM_NAME_DEFAULT}\"") set(CMAKE_GENERATOR_PLATFORM "Test Platform") diff --git a/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt index b9bb3b2..6867790 100644 --- a/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt +++ b/Tests/RunCMake/GeneratorPlatform/TestPlatformToolchain-stderr.txt @@ -1,3 +1,4 @@ +CMAKE_VS_PLATFORM_NAME_DEFAULT is "[^"]+" CMake Error at TestPlatformToolchain.cmake:[0-9]+ \(message\): CMAKE_GENERATOR_PLATFORM is "Test Platform" as expected. Call Stack \(most recent call first\): |