summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-02-17 15:25:29 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2023-02-28 13:24:03 (GMT)
commitfcbd723a5085c11c57ec966f8aea605a55d0bdd5 (patch)
treec3063c72d82eaf6044342ac1ad8bdd7bcd1e4758 /Source/cmTarget.cxx
parent22a491c3ea790532511e8de09692ccd002447c9d (diff)
downloadCMake-fcbd723a5085c11c57ec966f8aea605a55d0bdd5.zip
CMake-fcbd723a5085c11c57ec966f8aea605a55d0bdd5.tar.gz
CMake-fcbd723a5085c11c57ec966f8aea605a55d0bdd5.tar.bz2
Enhance support functions
* Avoid duplicate definiitions for IsExecutableWithExports, etc... * Add helper IsApple()
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 91d5de6..9ae2576 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -611,7 +611,6 @@ TargetProperty const StaticTargetProperties[] = {
#undef COMMON_LANGUAGE_PROPERTIES
#undef IC
#undef R
-
}
class cmTargetInternals
@@ -628,6 +627,7 @@ public:
bool HaveInstallRule;
bool IsDLLPlatform;
bool IsAIX;
+ bool IsApple;
bool IsAndroid;
bool BuildInterfaceIncludesAppended;
bool PerConfig;
@@ -914,6 +914,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->impl->HaveInstallRule = false;
this->impl->IsDLLPlatform = false;
this->impl->IsAIX = false;
+ this->impl->IsApple = false;
this->impl->IsAndroid = false;
this->impl->TargetVisibility = vis;
this->impl->BuildInterfaceIncludesAppended = false;
@@ -931,6 +932,9 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->impl->IsAIX = (systemName == "AIX" || systemName == "OS400");
}
+ // Check whether we are targeting Apple.
+ this->impl->IsApple = this->impl->Makefile->IsOn("APPLE");
+
// Check whether we are targeting an Android platform.
this->impl->IsAndroid = (this->impl->Makefile->GetSafeDefinition(
"CMAKE_SYSTEM_NAME") == "Android");
@@ -1205,14 +1209,12 @@ bool cmTarget::IsFrameworkOnApple() const
{
return ((this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::STATIC_LIBRARY) &&
- this->impl->Makefile->IsOn("APPLE") &&
- this->GetPropertyAsBool("FRAMEWORK"));
+ this->IsApple() && this->GetPropertyAsBool("FRAMEWORK"));
}
bool cmTarget::IsAppBundleOnApple() const
{
- return (this->GetType() == cmStateEnums::EXECUTABLE &&
- this->impl->Makefile->IsOn("APPLE") &&
+ return (this->GetType() == cmStateEnums::EXECUTABLE && this->IsApple() &&
this->GetPropertyAsBool("MACOSX_BUNDLE"));
}
@@ -1774,7 +1776,6 @@ std::string ConvertToString<cmValue>(cmValue value)
{
return std::string(*value);
}
-
}
template <typename ValueType>
@@ -2553,6 +2554,10 @@ bool cmTarget::IsAIX() const
{
return this->impl->IsAIX;
}
+bool cmTarget::IsApple() const
+{
+ return this->impl->IsApple;
+}
bool cmTarget::IsNormal() const
{