Files
CMake/Help/variable/CMAKE_VS_WINRT_BY_DEFAULT.rst
Petr Polezhaev 557ea4614e 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
2019-12-16 13:46:59 -05:00

19 lines
788 B
ReStructuredText

CMAKE_VS_WINRT_BY_DEFAULT
-------------------------
Inform :ref:`Visual Studio Generators` for VS 2010 and above that the
target platform enables WinRT compilation by default and it needs to
be explicitly disabled if ``/ZW`` or :prop_tgt:`VS_WINRT_COMPONENT` is
omitted (as opposed to enabling it when either of those options is
present)
This makes cmake configuration consistent in terms of WinRT among
platforms - if you did not enable the WinRT compilation explicitly, it
will be disabled (by either not enabling it or explicitly disabling it)
Note: WinRT compilation is always explicitly disabled for C language
source files, even if it is expliclty enabled for a project
This variable is meant to be set by a
:variable:`toolchain file <CMAKE_TOOLCHAIN_FILE>` for such platforms.