diff options
author | Brad King <brad.king@kitware.com> | 2022-09-09 13:48:40 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-09-09 13:48:56 (GMT) |
commit | 06404a19796ea0bbc5fdbbc986bb526a4a84066d (patch) | |
tree | 71992e13c6359fdcd27cf5a71d82e5975e3ef8ef /Source | |
parent | 347fa6169f7348f47637ee63e3ca14cee0780e68 (diff) | |
parent | 985b4c82a64c064e1d22351091206e73ed6fc727 (diff) | |
download | CMake-06404a19796ea0bbc5fdbbc986bb526a4a84066d.zip CMake-06404a19796ea0bbc5fdbbc986bb526a4a84066d.tar.gz CMake-06404a19796ea0bbc5fdbbc986bb526a4a84066d.tar.bz2 |
Merge topic 'check-library-properties-fix-performances-regression'
985b4c82a6 Check link libraries properties: fix performances regression
a47eef32a3 renames method FinalizeTargetCompileInfo() in FinalizeTargetConfiguration().
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7651
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmLinkLibrariesCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 25 | ||||
-rw-r--r-- | Source/cmMakefile.h | 1 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 82 | ||||
-rw-r--r-- | Source/cmTarget.h | 2 | ||||
-rw-r--r-- | Source/cmTargetLinkLibrariesCommand.cxx | 3 |
9 files changed, 54 insertions, 73 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 54c900f..7f1e426 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8666,7 +8666,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification() verifyTarget->SetProperty("UNITY_BUILD", "OFF"); cm::optional<std::map<std::string, cmValue>> perConfigCompileDefinitions; - verifyTarget->FinalizeTargetCompileInfo( + verifyTarget->FinalizeTargetConfiguration( this->Makefile->GetCompileDefinitionsEntries(), perConfigCompileDefinitions); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 07ad1e8..09aaa24 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1501,7 +1501,7 @@ bool cmGlobalGenerator::Compute() if (!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) { return false; } - this->FinalizeTargetCompileInfo(); + this->FinalizeTargetConfiguration(); this->CreateGenerationObjects(); @@ -1825,7 +1825,7 @@ cmGlobalGenerator::CreateMSVC60LinkLineComputer( cm::make_unique<cmMSVC60LinkLineComputer>(outputConverter, stateDir)); } -void cmGlobalGenerator::FinalizeTargetCompileInfo() +void cmGlobalGenerator::FinalizeTargetConfiguration() { std::vector<std::string> const langs = this->CMakeInstance->GetState()->GetEnabledLanguages(); @@ -1838,8 +1838,8 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() for (auto& target : mf->GetTargets()) { cmTarget* t = &target.second; - t->FinalizeTargetCompileInfo(noConfigCompileDefinitions, - perConfigCompileDefinitions); + t->FinalizeTargetConfiguration(noConfigCompileDefinitions, + perConfigCompileDefinitions); } // The standard include directories for each language diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index dcef070..6e3072b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -694,7 +694,7 @@ private: void WriteSummary(); void WriteSummary(cmGeneratorTarget* target); - void FinalizeTargetCompileInfo(); + void FinalizeTargetConfiguration(); virtual void ForceLinkerLanguages(); diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index ed89e91..2b8f836 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -35,7 +35,5 @@ bool cmLinkLibrariesCommand(std::vector<std::string> const& args, mf.AppendProperty("LINK_LIBRARIES", *i); } - mf.CheckProperty("LINK_LIBRARIES"); - return true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 760ed5f..cf5d880 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4035,31 +4035,6 @@ std::vector<std::string> cmMakefile::GetPropertyKeys() const return this->StateSnapshot.GetDirectory().GetPropertyKeys(); } -void cmMakefile::CheckProperty(const std::string& prop) const -{ - // Certain properties need checking. - if (prop == "LINK_LIBRARIES") { - if (cmValue value = this->GetProperty(prop)) { - // Look for <LINK_LIBRARY:> internal pattern - static cmsys::RegularExpression linkPattern( - "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)"); - if (!linkPattern.find(value)) { - return; - } - - // Report an error. - this->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat("Property ", prop, " contains the invalid item \"", - linkPattern.match(2), "\". The ", prop, - " property may contain the generator-expression \"$<LINK_", - linkPattern.match(3), - ":...>\" which may be used to specify how the libraries are " - "linked.")); - } - } -} - cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const { auto i = this->Targets.find(name); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1763177..873454d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -808,7 +808,6 @@ public: cmValue GetProperty(const std::string& prop, bool chain) const; bool GetPropertyAsBool(const std::string& prop) const; std::vector<std::string> GetPropertyKeys() const; - void CheckProperty(const std::string& prop) const; //! Initialize a makefile from its parent void InitializeFromParent(cmMakefile* parent); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index eb3feaa..25ff3bf 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1947,7 +1947,41 @@ void cmTarget::AppendBuildInterfaceIncludes() } } -void cmTarget::FinalizeTargetCompileInfo( +namespace { +bool CheckLinkLibraryPattern(cm::string_view property, + const std::vector<BT<std::string>>& value, + cmake* context) +{ + // Look for <LINK_LIBRARY:> and </LINK_LIBRARY:> internal tags + static cmsys::RegularExpression linkPattern( + "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)"); + + bool isValid = true; + + for (const auto& item : value) { + if (!linkPattern.find(item.Value)) { + continue; + } + + isValid = false; + + // Report an error. + context->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat( + "Property ", property, " contains the invalid item \"", + linkPattern.match(2), "\". The ", property, + " property may contain the generator-expression \"$<LINK_", + linkPattern.match(3), + ":...>\" which may be used to specify how the libraries are linked."), + item.Backtrace); + } + + return isValid; +} +} + +void cmTarget::FinalizeTargetConfiguration( const cmBTStringRange& noConfigCompileDefinitions, cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions) { @@ -1955,6 +1989,18 @@ void cmTarget::FinalizeTargetCompileInfo( return; } + if (!CheckLinkLibraryPattern("LINK_LIBRARIES"_s, + this->impl->LinkImplementationPropertyEntries, + this->GetMakefile()->GetCMakeInstance()) || + !CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES"_s, + this->impl->LinkInterfacePropertyEntries, + this->GetMakefile()->GetCMakeInstance()) || + !CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES_DIRECT"_s, + this->impl->LinkInterfaceDirectPropertyEntries, + this->GetMakefile()->GetCMakeInstance())) { + return; + } + this->AppendBuildInterfaceIncludes(); if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { @@ -2035,27 +2081,6 @@ void cmTarget::InsertPrecompileHeader(BT<std::string> const& entry) } namespace { -void CheckLinkLibraryPattern(const std::string& property, - const std::string& value, cmMakefile* context) -{ - // Look for <LINK_LIBRARY:> and </LINK_LIBRARY:> internal tags - static cmsys::RegularExpression linkPattern( - "(^|;)(</?LINK_(LIBRARY|GROUP):[^;>]*>)(;|$)"); - if (!linkPattern.find(value)) { - return; - } - - // Report an error. - context->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat( - "Property ", property, " contains the invalid item \"", - linkPattern.match(2), "\". The ", property, - " property may contain the generator-expression \"$<LINK_", - linkPattern.match(3), - ":...>\" which may be used to specify how the libraries are linked.")); -} - void CheckLINK_INTERFACE_LIBRARIES(const std::string& prop, const std::string& value, cmMakefile* context, bool imported) @@ -2090,13 +2115,6 @@ void CheckLINK_INTERFACE_LIBRARIES(const std::string& prop, } context->IssueMessage(MessageType::FATAL_ERROR, e.str()); } - - CheckLinkLibraryPattern(base, value, context); -} - -void CheckLINK_LIBRARIES(const std::string& value, cmMakefile* context) -{ - CheckLinkLibraryPattern("LINK_LIBRARIES", value, context); } void CheckINTERFACE_LINK_LIBRARIES(const std::string& value, @@ -2117,8 +2135,6 @@ void CheckINTERFACE_LINK_LIBRARIES(const std::string& value, context->IssueMessage(MessageType::FATAL_ERROR, e.str()); } - - CheckLinkLibraryPattern("INTERFACE_LINK_LIBRARIES", value, context); } void CheckIMPORTED_GLOBAL(const cmTarget* target, cmMakefile* context) @@ -2151,10 +2167,6 @@ void cmTarget::CheckProperty(const std::string& prop, if (cmValue value = this->GetProperty(prop)) { CheckLINK_INTERFACE_LIBRARIES(prop, *value, context, true); } - } else if (prop == "LINK_LIBRARIES") { - if (cmValue value = this->GetProperty(prop)) { - CheckLINK_LIBRARIES(*value, context); - } } else if (prop == "INTERFACE_LINK_LIBRARIES") { if (cmValue value = this->GetProperty(prop)) { CheckINTERFACE_LINK_LIBRARIES(*value, context); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 1550f5b..38bd036 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -238,7 +238,7 @@ public: void InsertPrecompileHeader(BT<std::string> const& entry); void AppendBuildInterfaceIncludes(); - void FinalizeTargetCompileInfo( + void FinalizeTargetConfiguration( const cmBTStringRange& noConfigCompileDefinitions, cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions); diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index fb03b62..0b123b2 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -379,9 +379,6 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args, target->SetProperty("LINK_INTERFACE_LIBRARIES", ""); } - target->CheckProperty("LINK_LIBRARIES", &mf); - target->CheckProperty("INTERFACE_LINK_LIBRARIES", &mf); - return true; } |