diff options
author | Brad King <brad.king@kitware.com> | 2023-10-04 19:48:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-10-05 17:17:00 (GMT) |
commit | b8ead378def8dc03dcae6b65f956c26c585eba3e (patch) | |
tree | e4658121d42f5b6079059b590a5f72449f0d08d7 /Source | |
parent | 68fca3eafeaf244c37843f186bd4af8a314df08c (diff) | |
download | CMake-b8ead378def8dc03dcae6b65f956c26c585eba3e.zip CMake-b8ead378def8dc03dcae6b65f956c26c585eba3e.tar.gz CMake-b8ead378def8dc03dcae6b65f956c26c585eba3e.tar.bz2 |
cxxmodules: Scan only targets that explicitly enable C++ 20
Previously we scanned any targets for which C++ 20 is enabled,
even if enabled only by the compiler's default, such as when
`CXXFLAGS=-std=c++20`.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1c339de..01af14f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -9142,13 +9142,11 @@ cmGeneratorTarget::Cxx20SupportLevel cmGeneratorTarget::HaveCxxModuleSupport( } cmStandardLevelResolver standardResolver(this->Makefile); - if (!standardResolver.HaveStandardAvailable(this, "CXX", config, - "cxx_std_20") || - // During the ABI detection step we do not know the compiler's features. - // HaveStandardAvailable may return true as a fallback, but in this code - // path we do not want to assume C++ 20 is available. - this->Makefile->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES") - .IsEmpty()) { + cmStandardLevel const cxxStd20 = + *standardResolver.LanguageStandardLevel("CXX", "20"); + cm::optional<cmStandardLevel> explicitLevel = + this->GetExplicitStandardLevel("CXX", config); + if (!explicitLevel || *explicitLevel < cxxStd20) { return Cxx20SupportLevel::NoCxx20; } |