summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-07-28 12:11:11 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-07-28 12:11:19 (GMT)
commitd9cca8e83df9900565e5101e389c916c33f80466 (patch)
treeddd6098aadae8b7c63159273d616694b6ed83421 /Source/cmTarget.cxx
parente7670480b35472915979d72eeac413859b8ef1ab (diff)
parent27fd172d8dcd42f5c9dc362cc3572f4f4d8132cd (diff)
downloadCMake-d9cca8e83df9900565e5101e389c916c33f80466.zip
CMake-d9cca8e83df9900565e5101e389c916c33f80466.tar.gz
CMake-d9cca8e83df9900565e5101e389c916c33f80466.tar.bz2
Merge topic 'verify-interface-header-sets-add-compile-definitions'
27fd172d8d VERIFY_INTERFACE_HEADER_SETS: Finalize compile info for verify targets 626e641a19 cmTarget: Factor out FinalizeTargetCompileInfo() Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7516
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c76e2cb..eafea05 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1935,6 +1935,51 @@ void cmTarget::AppendBuildInterfaceIncludes()
}
}
+void cmTarget::FinalizeTargetCompileInfo(
+ const cmBTStringRange& noConfigCompileDefinitions,
+ cm::optional<std::map<std::string, cmValue>>& perConfigCompileDefinitions)
+{
+ if (this->GetType() == cmStateEnums::GLOBAL_TARGET) {
+ return;
+ }
+
+ this->AppendBuildInterfaceIncludes();
+
+ if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ return;
+ }
+
+ for (auto const& def : noConfigCompileDefinitions) {
+ this->InsertCompileDefinition(def);
+ }
+
+ auto* mf = this->GetMakefile();
+ cmPolicies::PolicyStatus polSt = mf->GetPolicyStatus(cmPolicies::CMP0043);
+ if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
+ if (perConfigCompileDefinitions) {
+ for (auto const& it : *perConfigCompileDefinitions) {
+ if (cmValue val = it.second) {
+ this->AppendProperty(it.first, *val);
+ }
+ }
+ } else {
+ perConfigCompileDefinitions.emplace();
+ std::vector<std::string> configs =
+ mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
+
+ for (std::string const& c : configs) {
+ std::string defPropName =
+ cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(c));
+ cmValue val = mf->GetProperty(defPropName);
+ (*perConfigCompileDefinitions)[defPropName] = val;
+ if (val) {
+ this->AppendProperty(defPropName, *val);
+ }
+ }
+ }
+ }
+}
+
void cmTarget::InsertInclude(BT<std::string> const& entry, bool before)
{
auto position = before ? this->impl->IncludeDirectoriesEntries.begin()