summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-02-08 06:30:48 (GMT)
committerCraig Scott <craig.scott@crascit.com>2021-02-08 07:02:46 (GMT)
commit0110aa018d81a7b0f1f9371fcd038b71fefae554 (patch)
treeb6232f4855654052c2eba15f663154ec19dc2b55 /Source/cmLocalXCodeGenerator.cxx
parentf0257a87a3c282e2ea0c0a06556d4fedeb4cfe95 (diff)
downloadCMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.zip
CMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.tar.gz
CMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.tar.bz2
IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)
Xcode 12 doesn't allow nested builds within the same build directory. That means we can no longer do an install by building the install target when IOS_INSTALL_COMBINED is true. We can, however, still do an install by running the cmake_install.cmake script or executing cmake --install, since there is no outer build and therefore the associated SDK can be built as a sub-build. The non-build methods previously didn't work when IOS_INSTALL_COMBINED was true because the generated install script and the CMakeIOSInstallCombined script both made certain assumptions that relied on being part of a build. Those assumptions are now removed. A side-effect of this work is that cpack now also works from the command line when IOS_INSTALL_COMBINED is true. Relates: #21282 Fixes: #20023
Diffstat (limited to 'Source/cmLocalXCodeGenerator.cxx')
-rw-r--r--Source/cmLocalXCodeGenerator.cxx60
1 files changed, 57 insertions, 3 deletions
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index ac0d35e..3b4e3a8 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -4,6 +4,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalXCodeGenerator.h"
+#include "cmMakefile.h"
#include "cmSourceFile.h"
class cmGeneratorTarget;
@@ -45,13 +46,66 @@ void cmLocalXCodeGenerator::Generate()
}
}
-void cmLocalXCodeGenerator::GenerateInstallRules()
+void cmLocalXCodeGenerator::AddGeneratorSpecificInstallSetup(std::ostream& os)
{
- cmLocalGenerator::GenerateInstallRules();
-
+ // First check if we need to warn about incompatible settings
for (const auto& target : this->GetGeneratorTargets()) {
target->HasMacOSXRpathInstallNameDir("");
}
+
+ // CMakeIOSInstallCombined.cmake needs to know the location of the top of
+ // the build directory
+ os << "set(CMAKE_BINARY_DIR \"" << this->GetBinaryDirectory() << "\")\n\n";
+
+ if (this->Makefile->PlatformIsAppleEmbedded()) {
+ std::string platformName;
+ switch (this->Makefile->GetAppleSDKType()) {
+ case cmMakefile::AppleSDK::IPhoneOS:
+ platformName = "iphoneos";
+ break;
+ case cmMakefile::AppleSDK::IPhoneSimulator:
+ platformName = "iphonesimulator";
+ break;
+ case cmMakefile::AppleSDK::AppleTVOS:
+ platformName = "appletvos";
+ break;
+ case cmMakefile::AppleSDK::AppleTVSimulator:
+ platformName = "appletvsimulator";
+ break;
+ case cmMakefile::AppleSDK::WatchOS:
+ platformName = "watchos";
+ break;
+ case cmMakefile::AppleSDK::WatchSimulator:
+ platformName = "watchsimulator";
+ break;
+ case cmMakefile::AppleSDK::MacOS:
+ break;
+ }
+ if (!platformName.empty()) {
+ // The effective platform name is just the platform name with a hyphen
+ // prepended. We can get the SUPPORTED_PLATFORMS from the project file
+ // at runtime, so we don't need to compute that here.
+ /* clang-format off */
+ os <<
+ "if(NOT PLATFORM_NAME)\n"
+ " if(NOT \"$ENV{PLATFORM_NAME}\" STREQUAL \"\")\n"
+ " set(PLATFORM_NAME \"$ENV{PLATFORM_NAME}\")\n"
+ " endif()\n"
+ " if(NOT PLATFORM_NAME)\n"
+ " set(PLATFORM_NAME " << platformName << ")\n"
+ " endif()\n"
+ "endif()\n\n"
+ "if(NOT EFFECTIVE_PLATFORM_NAME)\n"
+ " if(NOT \"$ENV{EFFECTIVE_PLATFORM_NAME}\" STREQUAL \"\")\n"
+ " set(EFFECTIVE_PLATFORM_NAME \"$ENV{EFFECTIVE_PLATFORM_NAME}\")\n"
+ " endif()\n"
+ " if(NOT EFFECTIVE_PLATFORM_NAME)\n"
+ " set(EFFECTIVE_PLATFORM_NAME -" << platformName << ")\n"
+ " endif()\n"
+ "endif()\n\n";
+ /* clang-format off */
+ }
+ }
}
void cmLocalXCodeGenerator::ComputeObjectFilenames(