diff options
author | Brad King <brad.king@kitware.com> | 2024-01-10 15:14:58 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-01-10 15:15:44 (GMT) |
commit | 2858af8d6b503c073f36e1ed47c5b88b2ad36506 (patch) | |
tree | 55786f7d299bd43367fc62b659a0361f1d5ae28c /Help | |
parent | 3d14d84443e22a799c521edf543bb85b7f03823e (diff) | |
parent | 63bbb3768d3cf87459b6b66effa8726f38cc745a (diff) | |
download | CMake-2858af8d6b503c073f36e1ed47c5b88b2ad36506.zip CMake-2858af8d6b503c073f36e1ed47c5b88b2ad36506.tar.gz CMake-2858af8d6b503c073f36e1ed47c5b88b2ad36506.tar.bz2 |
Merge topic 'cxxmodules-no-unity' into release-3.28
63bbb3768d cmLocalGenerator: ignore scanned sources for unity builds
76b5383123 cmGlobalGenerator: add unity sources after computing target compile features
7fc2a83fe6 Tests/CXXModules: add a test with unity build support
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9118
Diffstat (limited to 'Help')
-rw-r--r-- | Help/manual/cmake-cxxmodules.7.rst | 4 | ||||
-rw-r--r-- | Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst | 4 | ||||
-rw-r--r-- | Help/prop_tgt/UNITY_BUILD.rst | 5 |
3 files changed, 13 insertions, 0 deletions
diff --git a/Help/manual/cmake-cxxmodules.7.rst b/Help/manual/cmake-cxxmodules.7.rst index b4c9cf1..3ee6645 100644 --- a/Help/manual/cmake-cxxmodules.7.rst +++ b/Help/manual/cmake-cxxmodules.7.rst @@ -30,6 +30,10 @@ following queries. The first query that provides a yes/no answer is used. - Otherwise, the source file will be scanned if the compiler and generator support scanning. See policy :policy:`CMP0155`. +Note that any scanned source will be excluded from any unity build (see +:prop_tgt:`UNITY_BUILD`) because module-related statements can only happen at +one place within a C++ translation unit. + Compiler Support ================ diff --git a/Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst b/Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst index ae526ac..38a0a78 100644 --- a/Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst +++ b/Help/prop_sf/SKIP_UNITY_BUILD_INCLUSION.rst @@ -11,3 +11,7 @@ in the same way as it would with unity builds disabled. This property helps with "ODR (One definition rule)" problems where combining a particular source file with others might lead to build errors or other unintended side effects. + +Note that sources which are scanned for C++ modules (see +:manual:`cmake-cxxmodules(7)`) are not eligible for unity build inclusion and +will automatically be excluded. diff --git a/Help/prop_tgt/UNITY_BUILD.rst b/Help/prop_tgt/UNITY_BUILD.rst index f827a20..9d68250 100644 --- a/Help/prop_tgt/UNITY_BUILD.rst +++ b/Help/prop_tgt/UNITY_BUILD.rst @@ -64,6 +64,11 @@ a number of measures to help address such problems: :prop_sf:`INCLUDE_DIRECTORIES` source property will not be combined into a unity source. +* Any source file which is scanned for C++ module sources via + :prop_tgt:`CXX_SCAN_FOR_MODULES`, :prop_sf:`CXX_SCAN_FOR_MODULES`, or + membership of a ``CXX_MODULES`` file set will not be combined into a unity + source. See :manual:`cmake-cxxmodules(7)` for details. + * Projects can prevent an individual source file from being combined into a unity source by setting its :prop_sf:`SKIP_UNITY_BUILD_INCLUSION` source property to true. This can be a more effective way to prevent |