summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-02-17 16:25:29 +0100
committerMarc Chevrier <marc.chevrier@gmail.com>2023-02-28 14:24:03 +0100
commitfcbd723a5085c11c57ec966f8aea605a55d0bdd5 (patch)
treec3063c72d82eaf6044342ac1ad8bdd7bcd1e4758 /Source/cmGeneratorTarget.cxx
parent22a491c3ea790532511e8de09692ccd002447c9d (diff)
downloadcmake-fcbd723a5085c11c57ec966f8aea605a55d0bdd5.tar.gz
Enhance support functions
* Avoid duplicate definiitions for IsExecutableWithExports, etc... * Add helper IsApple()
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx36
1 files changed, 20 insertions, 16 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index be6456b789..446e908be6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3074,6 +3074,16 @@ void cmGeneratorTarget::ComputeModuleDefinitionInfo(
}
}
+bool cmGeneratorTarget::IsAIX() const
+{
+ return this->Target->IsAIX();
+}
+
+bool cmGeneratorTarget::IsApple() const
+{
+ return this->Target->IsApple();
+}
+
bool cmGeneratorTarget::IsDLLPlatform() const
{
return this->Target->IsDLLPlatform();
@@ -3412,7 +3422,7 @@ std::string cmGeneratorTarget::GetCompilePDBDirectory(
void cmGeneratorTarget::GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const
{
- if (!this->Makefile->IsOn("APPLE")) {
+ if (!this->IsApple()) {
return;
}
cmValue archs = nullptr;
@@ -3910,7 +3920,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
AddInterfaceEntries(this, config, "INTERFACE_INCLUDE_DIRECTORIES", lang,
&dagChecker, entries, IncludeRuntimeInterface::Yes);
- if (this->Makefile->IsOn("APPLE")) {
+ if (this->IsApple()) {
if (cmLinkImplementationLibraries const* impl =
this->GetLinkImplementationLibraries(config,
LinkInterfaceFor::Usage)) {
@@ -6757,12 +6767,12 @@ void cmGeneratorTarget::ComputeVersionedName(
std::string& vName, std::string const& prefix, std::string const& base,
std::string const& suffix, std::string const& name, cmValue version) const
{
- vName = this->Makefile->IsOn("APPLE") ? (prefix + base) : name;
+ vName = this->IsApple() ? (prefix + base) : name;
if (version) {
vName += ".";
vName += *version;
}
- vName += this->Makefile->IsOn("APPLE") ? suffix : std::string();
+ vName += this->IsApple() ? suffix : std::string();
}
std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const
@@ -8531,8 +8541,7 @@ bool cmGeneratorTarget::HasContextDependentSources() const
bool cmGeneratorTarget::IsExecutableWithExports() const
{
- return (this->GetType() == cmStateEnums::EXECUTABLE &&
- this->GetPropertyAsBool("ENABLE_EXPORTS"));
+ return this->Target->IsExecutableWithExports();
}
bool cmGeneratorTarget::HasImportLibrary(std::string const& config) const
@@ -8543,7 +8552,7 @@ bool cmGeneratorTarget::HasImportLibrary(std::string const& config) const
// Assemblies which have only managed code do not have
// import libraries.
this->GetManagedType(config) != ManagedType::Managed) ||
- (this->Target->IsAIX() && this->IsExecutableWithExports());
+ (this->IsAIX() && this->IsExecutableWithExports());
}
bool cmGeneratorTarget::NeedImportLibraryName(std::string const& config) const
@@ -8581,17 +8590,12 @@ bool cmGeneratorTarget::IsLinkable() const
bool cmGeneratorTarget::IsFrameworkOnApple() const
{
- return ((this->GetType() == cmStateEnums::SHARED_LIBRARY ||
- this->GetType() == cmStateEnums::STATIC_LIBRARY) &&
- this->Makefile->IsOn("APPLE") &&
- this->GetPropertyAsBool("FRAMEWORK"));
+ return this->Target->IsFrameworkOnApple();
}
bool cmGeneratorTarget::IsAppBundleOnApple() const
{
- return (this->GetType() == cmStateEnums::EXECUTABLE &&
- this->Makefile->IsOn("APPLE") &&
- this->GetPropertyAsBool("MACOSX_BUNDLE"));
+ return this->Target->IsAppBundleOnApple();
}
bool cmGeneratorTarget::IsXCTestOnApple() const
@@ -8601,8 +8605,8 @@ bool cmGeneratorTarget::IsXCTestOnApple() const
bool cmGeneratorTarget::IsCFBundleOnApple() const
{
- return (this->GetType() == cmStateEnums::MODULE_LIBRARY &&
- this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("BUNDLE"));
+ return (this->GetType() == cmStateEnums::MODULE_LIBRARY && this->IsApple() &&
+ this->GetPropertyAsBool("BUNDLE"));
}
cmGeneratorTarget::ManagedType cmGeneratorTarget::CheckManagedType(