diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2015-08-18 19:30:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-08-24 13:50:20 (GMT) |
commit | 744e6c497c01cb3a3129ca66d1cabfa83e17dbd4 (patch) | |
tree | 06c08c6e6772c19bbaaaf20f4bb460adef1d8d6e /Source | |
parent | a712575da1a0e6117c4682100e3b9df72b964b2a (diff) | |
download | CMake-744e6c497c01cb3a3129ca66d1cabfa83e17dbd4.zip CMake-744e6c497c01cb3a3129ca66d1cabfa83e17dbd4.tar.gz CMake-744e6c497c01cb3a3129ca66d1cabfa83e17dbd4.tar.bz2 |
Fix iOS Bundle layouts (#15669)
In contrast to Mac OS X App bundle layout the iOS one lacks the
Contents/MacOSX structure. See also the Bundle Structures documentation
in Mac Developer Library:
https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html
For now detect iOS targets by checking the SDK name/path.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 30 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 12 | ||||
-rw-r--r-- | Source/cmMakefile.h | 3 |
3 files changed, 35 insertions, 10 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 299c112..b9f78c6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -951,9 +951,13 @@ cmGeneratorTarget::GetAppBundleDirectory(const std::string& config, bool contentOnly) const { std::string fpath = this->GetFullName(config, false); - fpath += ".app/Contents"; - if(!contentOnly) - fpath += "/MacOS"; + fpath += ".app"; + if(!this->Makefile->PlatformIsAppleIos()) + { + fpath += "/Contents"; + if(!contentOnly) + fpath += "/MacOS"; + } return fpath; } @@ -985,9 +989,12 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config, } } fpath += ext; - fpath += "/Contents"; - if(!contentOnly) - fpath += "/MacOS"; + if(!this->Makefile->PlatformIsAppleIos()) + { + fpath += "/Contents"; + if(!contentOnly) + fpath += "/MacOS"; + } return fpath; } @@ -999,7 +1006,7 @@ cmGeneratorTarget::GetFrameworkDirectory(const std::string& config, std::string fpath; fpath += this->GetOutputName(config, false); fpath += ".framework"; - if(!rootDir) + if(!rootDir && !this->Makefile->PlatformIsAppleIos()) { fpath += "/Versions/"; fpath += this->Target->GetFrameworkVersion(); @@ -2146,9 +2153,12 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, if(this->Target->IsFrameworkOnApple()) { realName = prefix; - realName += "Versions/"; - realName += this->Target->GetFrameworkVersion(); - realName += "/"; + if(!this->Makefile->PlatformIsAppleIos()) + { + realName += "Versions/"; + realName += this->Target->GetFrameworkVersion(); + realName += "/"; + } realName += base; soName = realName; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 85bc493..6e43b52 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2529,6 +2529,18 @@ bool cmMakefile::PlatformIs64Bit() const return false; } +bool cmMakefile::PlatformIsAppleIos() const +{ + std::string sdkRoot; + sdkRoot = this->GetSafeDefinition("CMAKE_OSX_SYSROOT"); + sdkRoot = cmSystemTools::LowerCase(sdkRoot); + + return sdkRoot.find("iphoneos") == 0 || + sdkRoot.find("/iphoneos") != std::string::npos || + sdkRoot.find("iphonesimulator") == 0 || + sdkRoot.find("/iphonesimulator") != std::string::npos; +} + const char* cmMakefile::GetSONameFlag(const std::string& language) const { std::string name = "CMAKE_SHARED_LIBRARY_SONAME"; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1c4da00..9f455cc 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -490,6 +490,9 @@ public: /** Return whether the target platform is 64-bit. */ bool PlatformIs64Bit() const; + /** Return whether the target platform is Apple iOS. */ + bool PlatformIsAppleIos() const; + /** Retrieve soname flag for the specified language if supported */ const char* GetSONameFlag(const std::string& language) const; |