diff options
author | Petr Polezhaev <petr.polezhaev@larian.com> | 2019-12-03 13:00:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-12-16 18:46:59 (GMT) |
commit | 557ea4614ee9352cbfff7798033175230a39e0e0 (patch) | |
tree | 6cb99eab4c4114e9767241c9d255d74eea4c2ad4 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 7bcef355bfa25e8d9d2dbc015b04831a7cf8c5a9 (diff) | |
download | CMake-557ea4614ee9352cbfff7798033175230a39e0e0.zip CMake-557ea4614ee9352cbfff7798033175230a39e0e0.tar.gz CMake-557ea4614ee9352cbfff7798033175230a39e0e0.tar.bz2 |
VS: Change CMAKE_VS_WINRT_BY_DEFAULT to not implicitly enable WinRT
Original behaviour would unconditionally enable WinRT for all projects
so source file flag generation code can acknowledge WinRT being present
and disable it for C language source files. An unintentional result of
that approach is that WinRT is enabled for ALL projects, including C++
projects/source files with no way to disable it
Instead use `CMAKE_VS_WINRT_BY_DEFAULT` as a hint that the platform is
WinRT-by-default and set global `CompileAsWinRT` flag to `false` unless
it was explicitly requested by either `WINRT_COMPONENT` option or `/ZW`
compilation option - similar to what Windows Phone/Windows Store
platform logic does
In case WinRT compilation is enabled for a project by either of
aforementioned methods, C language source file override logic will still
kick in and disable CompileAsWinRT for C source files
Fixes: #20063
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8fc40a79..5e005ea 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2832,10 +2832,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } if (this->MSTools) { - // 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")) { + // If we have the VS_WINRT_COMPONENT set then force Compile as WinRT + if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) { clOptions.AddFlag("CompileAsWinRT", "true"); // For WinRT components, add the _WINRT_DLL define to produce a lib if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || @@ -2843,7 +2841,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.AddDefine("_WINRT_DLL"); } } else if (this->GlobalGenerator->TargetsWindowsStore() || - this->GlobalGenerator->TargetsWindowsPhone()) { + this->GlobalGenerator->TargetsWindowsPhone() || + this->Makefile->IsOn("CMAKE_VS_WINRT_BY_DEFAULT")) { if (!clOptions.IsWinRt()) { clOptions.AddFlag("CompileAsWinRT", "false"); } |