Merge topic 'cxx-scanning-properties'

a02d792c6e cxxmodules: add properties to control scanning
008c09d6db cmNinjaTargetGenerator: factor out determining the fileset of a source

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7935
This commit is contained in:
Brad King
2022-11-21 15:00:00 +00:00
committed by Kitware Robot
17 changed files with 319 additions and 56 deletions

View File

@@ -195,6 +195,7 @@ Properties on Targets
/prop_tgt/CXX_MODULE_SET
/prop_tgt/CXX_MODULE_SET_NAME
/prop_tgt/CXX_MODULE_SETS
/prop_tgt/CXX_SCAN_FOR_MODULES
/prop_tgt/CXX_STANDARD
/prop_tgt/CXX_STANDARD_REQUIRED
/prop_tgt/DEBUG_POSTFIX
@@ -533,6 +534,7 @@ Properties on Source Files
/prop_sf/COMPILE_DEFINITIONS
/prop_sf/COMPILE_FLAGS
/prop_sf/COMPILE_OPTIONS
/prop_sf/CXX_SCAN_FOR_MODULES
/prop_sf/EXTERNAL_OBJECT
/prop_sf/Fortran_FORMAT
/prop_sf/Fortran_PREPROCESS

View File

@@ -417,6 +417,7 @@ Variables that Control the Build
/variable/CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS
/variable/CMAKE_CUDA_RUNTIME_LIBRARY
/variable/CMAKE_CUDA_SEPARABLE_COMPILATION
/variable/CMAKE_CXX_SCAN_FOR_MODULES
/variable/CMAKE_DEBUG_POSTFIX
/variable/CMAKE_DEFAULT_BUILD_TYPE
/variable/CMAKE_DEFAULT_CONFIGS

View File

@@ -0,0 +1,19 @@
CXX_SCAN_FOR_MODULES
--------------------
.. versionadded:: 3.26
``CXX_SCAN_FOR_MODULES`` is a boolean specifying whether CMake will scan the
source for C++ module dependencies. See also the
:prop_tgt:`CXX_SCAN_FOR_MODULES` for target-wide settings.
When this property is set ``ON``, CMake will scan the source at build time and
add module dependency information to the compile line as necessary. When this
property is set ``OFF``, CMake will not scan the source at build time. When
this property is unset, the :prop_tgt:`CXX_SCAN_FOR_MODULES` property is
consulted.
Note that scanning is only performed if C++20 or higher is enabled for the
target and the source uses the ``CXX`` language. Scanning for modules in
sources belonging to file sets of type ``CXX_MODULES`` and
``CXX_MODULES_HEADER_UNITS`` is always performed.

View File

@@ -0,0 +1,22 @@
CXX_SCAN_FOR_MODULES
--------------------
.. versionadded:: 3.26
``CXX_SCAN_FOR_MODULES`` is a boolean specifying whether CMake will scan C++
sources in the target for module dependencies. See also the
:prop_sf:`CXX_SCAN_FOR_MODULES` for per-source settings which, if set,
overrides the target-wide settings.
This property is initialized by the value of the
:variable:`CMAKE_CXX_SCAN_FOR_MODULES` variable if it is set when a target is
created.
When this property is set ``ON`` or unset, CMake will scan the target's
``CXX`` sources at build time and add module dependency information to the
compile line as necessary. When this property is set ``OFF``, CMake will not
scan the target's ``CXX`` sources at build time.
Note that scanning is only performed if C++20 or higher is enabled for the
target. Scanning for modules in the target's sources belonging to file sets
of type ``CXX_MODULES`` and ``CXX_MODULES_HEADER_UNITS`` is always performed.

View File

@@ -0,0 +1,5 @@
cxx-scanning-properties
-----------------------
* The :prop_tgt:`CXX_SCAN_FOR_MODULES` target and source file properties may
be used to enable or disable scanning for C++ module dependencies.

View File

@@ -0,0 +1,10 @@
CMAKE_CXX_SCAN_FOR_MODULES
--------------------------
.. versionadded:: 3.26
Whether to scan C++ source files for module dependencies.
This variable is used to initialize the :prop_tgt:`CXX_SCAN_FOR_MODULES`
property on all the targets. See that target property for additional
information.