diff options
author | Brad King <brad.king@kitware.com> | 2024-05-02 13:39:52 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-05-02 13:40:04 (GMT) |
commit | 718f43e7ee4ac84732a74751b8c9ffa69488c029 (patch) | |
tree | 0181ab6c80758cac07accbec28dd8452a0ee6ab4 /Source/cmGeneratorTarget.cxx | |
parent | 65196e2e3a5a3cb311e86fce80e22ca3e3fea010 (diff) | |
parent | 3022f0363fa7402588ddf911dc0076dc55e5e9fa (diff) | |
download | CMake-718f43e7ee4ac84732a74751b8c9ffa69488c029.zip CMake-718f43e7ee4ac84732a74751b8c9ffa69488c029.tar.gz CMake-718f43e7ee4ac84732a74751b8c9ffa69488c029.tar.bz2 |
Merge topic 'vs-scan-module-deps-settings'
3022f0363f VS: set ScanSourceForModuleDependencies at vcxproj level
dff511ad28 cmGeneratorTarget: add a target-level query for "needs dyndep"
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: AaronRuizMoraUK <aaronruizmora@gmail.com>
Merge-request: !9471
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index c14ff3a..38f25d7 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -9693,11 +9693,25 @@ bool cmGeneratorTarget::NeedDyndepForSource(std::string const& lang, return true; } + auto targetDyndep = this->NeedCxxDyndep(config); + if (targetDyndep == CxxModuleSupport::Unavailable) { + return false; + } + auto const sfProp = sf->GetProperty("CXX_SCAN_FOR_MODULES"); + if (sfProp.IsSet()) { + return sfProp.IsOn(); + } + return targetDyndep == CxxModuleSupport::Enabled; +} + +cmGeneratorTarget::CxxModuleSupport cmGeneratorTarget::NeedCxxDyndep( + std::string const& config) const +{ bool haveRule = false; switch (this->HaveCxxModuleSupport(config)) { case Cxx20SupportLevel::MissingCxx: case Cxx20SupportLevel::NoCxx20: - return false; + return CxxModuleSupport::Unavailable; case Cxx20SupportLevel::MissingRule: break; case Cxx20SupportLevel::Supported: @@ -9707,28 +9721,29 @@ bool cmGeneratorTarget::NeedDyndepForSource(std::string const& lang, bool haveGeneratorSupport = this->GetGlobalGenerator()->CheckCxxModuleSupport( cmGlobalGenerator::CxxModuleSupportQuery::Inspect); - auto const sfProp = sf->GetProperty("CXX_SCAN_FOR_MODULES"); - if (sfProp.IsSet()) { - return sfProp.IsOn(); - } auto const tgtProp = this->GetProperty("CXX_SCAN_FOR_MODULES"); if (tgtProp.IsSet()) { - return tgtProp.IsOn(); + return tgtProp.IsOn() ? CxxModuleSupport::Enabled + : CxxModuleSupport::Disabled; } - bool policyAnswer = false; + CxxModuleSupport policyAnswer = CxxModuleSupport::Unavailable; switch (this->GetPolicyStatusCMP0155()) { case cmPolicies::WARN: case cmPolicies::OLD: // The OLD behavior is to not scan the source. - policyAnswer = false; + policyAnswer = CxxModuleSupport::Disabled; break; case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: // The NEW behavior is to scan the source if the compiler supports // scanning and the generator supports it. - policyAnswer = haveRule && haveGeneratorSupport; + if (haveRule && haveGeneratorSupport) { + policyAnswer = CxxModuleSupport::Enabled; + } else { + policyAnswer = CxxModuleSupport::Disabled; + } break; } return policyAnswer; |