summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-11-04 14:27:48 (GMT)
committerGregor Jasny <gjasny@googlemail.com>2017-12-22 20:56:53 (GMT)
commit4017bf40de512e977d59c12f4e3f6c91f5dd953d (patch)
tree4ef1e4b8d4b325e5a746273c1d036d29215a82b4 /Source/cmMakefile.cxx
parent8f4663ffb265b6216cc9da9019e6169e27f0d8ec (diff)
downloadCMake-4017bf40de512e977d59c12f4e3f6c91f5dd953d.zip
CMake-4017bf40de512e977d59c12f4e3f6c91f5dd953d.tar.gz
CMake-4017bf40de512e977d59c12f4e3f6c91f5dd953d.tar.bz2
Darwin: Emit deployment target that matches the SDK
Closes: #17431
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx31
1 files changed, 22 insertions, 9 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c70a7ae..5d6029c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2244,25 +2244,38 @@ bool cmMakefile::PlatformIsx32() const
return false;
}
-bool cmMakefile::PlatformIsAppleEmbedded() const
+cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const
{
std::string sdkRoot;
sdkRoot = this->GetSafeDefinition("CMAKE_OSX_SYSROOT");
sdkRoot = cmSystemTools::LowerCase(sdkRoot);
- const std::string embedded[] = {
- "appletvos", "appletvsimulator", "iphoneos",
- "iphonesimulator", "watchos", "watchsimulator",
+ struct
+ {
+ std::string name;
+ AppleSDK sdk;
+ } const sdkDatabase[]{
+ { "appletvos", AppleSDK::AppleTVOS },
+ { "appletvsimulator", AppleSDK::AppleTVSimulator },
+ { "iphoneos", AppleSDK::IPhoneOS },
+ { "iphonesimulator", AppleSDK::IPhoneSimulator },
+ { "watchos", AppleSDK::WatchOS },
+ { "watchsimulator", AppleSDK::WatchSimulator },
};
- for (std::string const& i : embedded) {
- if (sdkRoot.find(i) == 0 ||
- sdkRoot.find(std::string("/") + i) != std::string::npos) {
- return true;
+ for (auto entry : sdkDatabase) {
+ if (sdkRoot.find(entry.name) == 0 ||
+ sdkRoot.find(std::string("/") + entry.name) != std::string::npos) {
+ return entry.sdk;
}
}
- return false;
+ return AppleSDK::MacOS;
+}
+
+bool cmMakefile::PlatformIsAppleEmbedded() const
+{
+ return GetAppleSDKType() != AppleSDK::MacOS;
}
const char* cmMakefile::GetSONameFlag(const std::string& language) const