summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGeneratorTarget.cxx5
-rw-r--r--Source/cmGeneratorTarget.h1
-rw-r--r--Source/cmGlobalGenerator.cxx16
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx3
-rw-r--r--Source/cmTarget.cxx31
-rw-r--r--Source/cmTarget.h1
7 files changed, 37 insertions, 22 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 9978320..beafdea 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1120,6 +1120,11 @@ bool cmGeneratorTarget::IsImportedGloballyVisible() const
return this->Target->IsImportedGloballyVisible();
}
+bool cmGeneratorTarget::CanCompileSources() const
+{
+ return this->Target->CanCompileSources();
+}
+
const std::string& cmGeneratorTarget::GetLocationForBuild() const
{
static std::string location;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 65683e6..4a03f65 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -48,6 +48,7 @@ public:
bool IsInBuildSystem() const;
bool IsImported() const;
bool IsImportedGloballyVisible() const;
+ bool CanCompileSources() const;
const std::string& GetLocation(const std::string& config) const;
std::vector<cmCustomCommand> const& GetPreBuildCommands() const;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index b79dfde..ac94a28 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -302,9 +302,7 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
bool failed = false;
for (const auto& localGen : this->LocalGenerators) {
for (const auto& target : localGen->GetGeneratorTargets()) {
- if (target->GetType() == cmStateEnums::TargetType::GLOBAL_TARGET ||
- target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY ||
- target->GetType() == cmStateEnums::TargetType::UTILITY ||
+ if (!target->CanCompileSources() ||
cmIsOn(target->GetProperty("ghs_integrity_app"))) {
continue;
}
@@ -358,9 +356,7 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
bool failed = false;
for (const auto& generator : this->LocalGenerators) {
for (const auto& target : generator->GetGeneratorTargets()) {
- if (target->GetType() == cmStateEnums::TargetType::GLOBAL_TARGET ||
- target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY ||
- target->GetType() == cmStateEnums::TargetType::UTILITY ||
+ if (!target->CanCompileSources() ||
cmIsOn(target->GetProperty("ghs_integrity_app"))) {
continue;
}
@@ -1595,9 +1591,7 @@ bool cmGlobalGenerator::AddAutomaticSources()
for (const auto& lg : this->LocalGenerators) {
lg->CreateEvaluationFileOutputs();
for (const auto& gt : lg->GetGeneratorTargets()) {
- if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
- gt->GetType() == cmStateEnums::UTILITY ||
- gt->GetType() == cmStateEnums::GLOBAL_TARGET) {
+ if (!gt->CanCompileSources()) {
continue;
}
lg->AddUnityBuild(gt.get());
@@ -1609,9 +1603,7 @@ bool cmGlobalGenerator::AddAutomaticSources()
}
for (const auto& lg : this->LocalGenerators) {
for (const auto& gt : lg->GetGeneratorTargets()) {
- if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
- gt->GetType() == cmStateEnums::UTILITY ||
- gt->GetType() == cmStateEnums::GLOBAL_TARGET) {
+ if (!gt->CanCompileSources()) {
continue;
}
// Handle targets that re-use a PCH from an above-handled target.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a39ed68..646cf5e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -797,7 +797,7 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures()
// Now that C/C++ _STANDARD values have been computed
// set the values to ObjC/ObjCXX _STANDARD variables
- if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
+ if (target->CanCompileSources()) {
for (std::string const& c : configNames) {
target->ComputeCompileFeatures(c, inferredEnabledLanguages);
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 08f0a5f..23e2a94 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -137,8 +137,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
std::map<std::string, LocalObjectInfo>& localObjectFiles)
{
for (const auto& gt : this->GetGeneratorTargets()) {
- if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
- gt->GetType() == cmStateEnums::UTILITY) {
+ if (!gt->CanCompileSources()) {
continue;
}
std::vector<cmSourceFile const*> objectSources;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 083095b..70bffa6 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -272,8 +272,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
};
// Setup default property values.
- if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
- this->GetType() != cmStateEnums::UTILITY) {
+ if (this->CanCompileSources()) {
initProp("ANDROID_API");
initProp("ANDROID_API_MIN");
initProp("ANDROID_ARCH");
@@ -505,6 +504,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
if (impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
impl->TargetType == cmStateEnums::MODULE_LIBRARY) {
this->SetProperty("POSITION_INDEPENDENT_CODE", "True");
+ } else if (this->CanCompileSources()) {
+ initProp("POSITION_INDEPENDENT_CODE");
}
if (impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
impl->TargetType == cmStateEnums::EXECUTABLE) {
@@ -512,11 +513,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("WINDOWS_EXPORT_ALL_SYMBOLS");
}
- if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
- this->GetType() != cmStateEnums::UTILITY) {
- initProp("POSITION_INDEPENDENT_CODE");
- }
-
// Record current policies for later use.
impl->Makefile->RecordPolicies(impl->PolicyMap);
@@ -1910,6 +1906,27 @@ bool cmTarget::IsPerConfig() const
return impl->PerConfig;
}
+bool cmTarget::CanCompileSources() const
+{
+ if (this->IsImported()) {
+ return false;
+ }
+ switch (this->GetType()) {
+ case cmStateEnums::EXECUTABLE:
+ case cmStateEnums::STATIC_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::OBJECT_LIBRARY:
+ return true;
+ case cmStateEnums::UTILITY:
+ case cmStateEnums::INTERFACE_LIBRARY:
+ case cmStateEnums::GLOBAL_TARGET:
+ case cmStateEnums::UNKNOWN_LIBRARY:
+ break;
+ }
+ return false;
+}
+
const char* cmTarget::GetSuffixVariableInternal(
cmStateEnums::ArtifactType artifact) const
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 7a16de8..43f1887 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -196,6 +196,7 @@ public:
bool IsImported() const;
bool IsImportedGloballyVisible() const;
bool IsPerConfig() const;
+ bool CanCompileSources() const;
bool GetMappedConfig(std::string const& desired_config, cmProp& loc,
cmProp& imp, std::string& suffix) const;