summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-07-27 16:03:08 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-07-27 16:24:53 (GMT)
commit626e641a19c2eadd0f204e87237748afcbe3b2b5 (patch)
tree0c82ae7fceeca3d995ca3702ffea294bebd13138 /Source/cmTarget.cxx
parent22c535299019eb835dd0d5793d3b40e59d0cc6ee (diff)
downloadCMake-626e641a19c2eadd0f204e87237748afcbe3b2b5.zip
CMake-626e641a19c2eadd0f204e87237748afcbe3b2b5.tar.gz
CMake-626e641a19c2eadd0f204e87237748afcbe3b2b5.tar.bz2
cmTarget: Factor out FinalizeTargetCompileInfo()
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 a8cd619..62ec344 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1881,6 +1881,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()