From e78a0c8e8a0b002a1e0e71672efcf96418c3a26d Mon Sep 17 00:00:00 2001 From: Mikhail Korolev Date: Tue, 28 Aug 2018 21:14:12 +0300 Subject: VS: Add option to tell generator that platfrom is WinRT by default Create a ``CMAKE_VS_WINRT_BY_DEFAULT`` variable to indicate this. Fixes: #18286 --- Help/manual/cmake-variables.7.rst | 1 + Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst | 8 ++++++++ Source/cmVisualStudio10TargetGenerator.cxx | 6 ++++-- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 4ddbfe5..3eea8a2 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -401,6 +401,7 @@ Variables that Control the Build /variable/CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES /variable/CMAKE_VS_SDK_REFERENCE_DIRECTORIES /variable/CMAKE_VS_SDK_SOURCE_DIRECTORIES + /variable/CMAKE_VS_WINRT_BY_DEFAULT /variable/CMAKE_WIN32_EXECUTABLE /variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS /variable/CMAKE_XCODE_ATTRIBUTE_an-attribute diff --git a/Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst b/Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst new file mode 100644 index 0000000..2ba8fe2 --- /dev/null +++ b/Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst @@ -0,0 +1,8 @@ +CMAKE_VS_WINRT_BY_DEFAULT +------------------------- + +Tell :ref:`Visual Studio Generators` for VS 2010 and above that the +target platform compiles as WinRT by default (compiles with ``/ZW``). + +This variable is meant to be set by a +:variable:`toolchain file ` for such platforms. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4597bc6..e5b9d79 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2571,8 +2571,10 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } if (this->MSTools) { - // If we have the VS_WINRT_COMPONENT set then force Compile as WinRT. - if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) { + // If we have the VS_WINRT_COMPONENT or CMAKE_VS_WINRT_BY_DEFAULT + // set then force Compile as WinRT. + if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") || + this->Makefile->IsOn("CMAKE_VS_WINRT_BY_DEFAULT")) { clOptions.AddFlag("CompileAsWinRT", "true"); // For WinRT components, add the _WINRT_DLL define to produce a lib if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || -- cgit v0.12