summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-01-24 19:45:24 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-01-24 19:45:24 (GMT)
commit6122fc54a9275caf3054a12bbc813be2c8036863 (patch)
tree93b09abb98fc0cf2d30a6ea5183b7d925c17c15d /Source
parent6c99ec5bfdc9710355e3318cb9884638ea2ce925 (diff)
parent10c9c73d58b481a212d1ed87ceeb227a7654bc56 (diff)
downloadCMake-6122fc54a9275caf3054a12bbc813be2c8036863.zip
CMake-6122fc54a9275caf3054a12bbc813be2c8036863.tar.gz
CMake-6122fc54a9275caf3054a12bbc813be2c8036863.tar.bz2
Merge topic '16253-xcode-effective-platform-name'
10c9c73d Xcode: Control emission of EFFECTIVE_PLATFORM_NAME
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx5
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmGlobalGenerator.h4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx14
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
5 files changed, 25 insertions, 4 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b6db0d6..dcf3764 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -4419,9 +4419,10 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// The generator may add the configuration's subdirectory.
if (!conf.empty()) {
- bool iosPlatform = this->Makefile->PlatformIsAppleIos();
+ bool useEPN =
+ this->GlobalGenerator->UseEffectivePlatformName(this->Makefile);
std::string suffix =
- usesDefaultOutputDir && iosPlatform ? "${EFFECTIVE_PLATFORM_NAME}" : "";
+ usesDefaultOutputDir && useEPN ? "${EFFECTIVE_PLATFORM_NAME}" : "";
this->LocalGenerator->GetGlobalGenerator()->AppendDirectoryForConfig(
"/", conf, suffix, out);
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2808051..f118250 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2342,8 +2342,8 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
singleLine.push_back(cmd);
if (cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.') {
std::string cfgArg = "-DBUILD_TYPE=";
- bool iosPlatform = mf->PlatformIsAppleIos();
- if (iosPlatform) {
+ bool useEPN = this->UseEffectivePlatformName(mf);
+ if (useEPN) {
cfgArg += "$(CONFIGURATION)";
singleLine.push_back(cfgArg);
cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)";
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 88ef8da..18e3730 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -333,6 +333,10 @@ public:
virtual bool UseFolderProperty() const;
+ /** Return whether the generator should use EFFECTIVE_PLATFORM_NAME. This is
+ relevant for mixed macOS and iOS builds. */
+ virtual bool UseEffectivePlatformName(cmMakefile*) const { return false; }
+
std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
/** Generate an <output>.rule file path for a given command output. */
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 96535eb..d448315 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -22,6 +22,7 @@
#include "cmOutputConverter.h"
#include "cmSourceFile.h"
#include "cmSourceGroup.h"
+#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -3544,6 +3545,19 @@ bool cmGlobalXCodeGenerator::IsMultiConfig() const
return true;
}
+bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const
+{
+ const char* epnValue =
+ this->GetCMakeInstance()->GetState()->GetGlobalProperty(
+ "XCODE_EMIT_EFFECTIVE_PLATFORM_NAME");
+
+ if (!epnValue) {
+ return mf->PlatformIsAppleIos();
+ }
+
+ return cmSystemTools::IsOn(epnValue);
+}
+
void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
cmGeneratorTarget* gt) const
{
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 42c39aa..1aaf9c7 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -86,6 +86,8 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
bool IsMultiConfig() const CM_OVERRIDE;
+ bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE;
+
bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) CM_OVERRIDE;
void AppendFlag(std::string& flags, std::string const& flag);