summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-10-28 02:43:37 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-01 13:52:08 (GMT)
commit889aa0354aa533dce0e96334401267aa30bff215 (patch)
tree1e6772eb7c07feddd9b1ae0fabcf34c23b08899b /Help
parente3747a2d4be427e97af01ca1cce1c6641d4dff74 (diff)
downloadCMake-889aa0354aa533dce0e96334401267aa30bff215.zip
CMake-889aa0354aa533dce0e96334401267aa30bff215.tar.gz
CMake-889aa0354aa533dce0e96334401267aa30bff215.tar.bz2
CMP0155: ignore scanning for sources if no scanner is available
This allows for a more graceful transition for projects using C++20 without scanner support (e.g., Clang 15 or GCC 13). While newer compilers will (needlessly) scan, it allows C++20-using projects to use older compilers without having to set `CMAKE_CXX_SCAN_FOR_MODULES` to support newer CMake minimum versions. Fixes: #25357
Diffstat (limited to 'Help')
-rw-r--r--Help/manual/cmake-cxxmodules.7.rst3
-rw-r--r--Help/manual/cmake-policies.7.rst2
-rw-r--r--Help/policy/CMP0155.rst6
3 files changed, 7 insertions, 4 deletions
diff --git a/Help/manual/cmake-cxxmodules.7.rst b/Help/manual/cmake-cxxmodules.7.rst
index 99915e3..b4c9cf1 100644
--- a/Help/manual/cmake-cxxmodules.7.rst
+++ b/Help/manual/cmake-cxxmodules.7.rst
@@ -27,7 +27,8 @@ following queries. The first query that provides a yes/no answer is used.
- If the :prop_tgt:`CXX_SCAN_FOR_MODULES` target property is set, its value
will be used. Set the :variable:`CMAKE_CXX_SCAN_FOR_MODULES` variable
to initialize this property on all targets as they are created.
-- Otherwise, the source file will be scanned. See policy :policy:`CMP0155`.
+- Otherwise, the source file will be scanned if the compiler and generator
+ support scanning. See policy :policy:`CMP0155`.
Compiler Support
================
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 047dfd1..46707ff 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -57,7 +57,7 @@ Policies Introduced by CMake 3.28
.. toctree::
:maxdepth: 1
- CMP0155: C++ sources in targets with at least C++20 are scanned for imports. </policy/CMP0155>
+ CMP0155: C++ sources in targets with at least C++20 are scanned for imports when supported. </policy/CMP0155>
CMP0154: Generated files are private by default in targets using file sets. </policy/CMP0154>
CMP0153: The exec_program command should not be called. </policy/CMP0153>
CMP0152: file(REAL_PATH) resolves symlinks before collapsing ../ components. </policy/CMP0152>
diff --git a/Help/policy/CMP0155.rst b/Help/policy/CMP0155.rst
index 2dafadf..8b741cb 100644
--- a/Help/policy/CMP0155.rst
+++ b/Help/policy/CMP0155.rst
@@ -3,7 +3,8 @@ CMP0155
.. versionadded:: 3.28
-C++ sources in targets with at least C++20 are scanned for imports.
+C++ sources in targets with at least C++20 are scanned for imports
+when supported.
CMake 3.27 and below assume that C++ sources do not ``import`` modules.
CMake 3.28 and above prefer to assume that C++ sources in targets using C++20
@@ -16,7 +17,8 @@ support.
The ``OLD`` behavior for this policy is to assume that C++ 20 and newer
sources do not import modules. The ``NEW`` behavior for this policy is to
-assume that C++ 20 and newer files may import modules, and need to be scanned.
+assume that C++ 20 and newer files may import modules if the compiler
+understands how to scan for their dependencies, and need to be scanned.
This policy was introduced in CMake version 3.28. Use the
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.