summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-12-20 15:16:57 (GMT)
committerBrad King <brad.king@kitware.com>2013-02-07 16:07:48 (GMT)
commitf980a8049522782779b3a721c37f976de1e38dcc (patch)
treed694350146e9b498cac71a991eeb64d173fb597f /Source
parent650c6471600fa8b06ed343ff3a4f3d16a3dc95bc (diff)
downloadCMake-f980a8049522782779b3a721c37f976de1e38dcc.zip
CMake-f980a8049522782779b3a721c37f976de1e38dcc.tar.gz
CMake-f980a8049522782779b3a721c37f976de1e38dcc.tar.bz2
Xcode: Implement generator toolset selection (#9831, #13802)
Implement generator toolset selection (cmake -T) for Xcode > 2.0 by adding the GCC_VERSION build setting to project files.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmDocumentVariables.cxx9
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx24
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmake.h1
4 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 2b9104c..9f7c0c1 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -303,6 +303,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
,false,
"Variables that Provide Information");
cm->DefineProperty
+ ("CMAKE_XCODE_PLATFORM_TOOLSET", cmProperty::VARIABLE,
+ "Xcode compiler selection.",
+ "Xcode supports selection of a compiler from one of the installed "
+ "toolsets. "
+ "CMake provides the name of the chosen toolset in this variable, "
+ "if any is explicitly selected (e.g. via the cmake -T option)."
+ ,false,
+ "Variables that Provide Information");
+ cm->DefineProperty
("CMAKE_MINOR_VERSION", cmProperty::VARIABLE,
"The Minor version of cmake (i.e. the 4 in X.4.X).",
"This specifies the minor version of the CMake"
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0681ce5..316ecfd 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -201,6 +201,20 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
}
//----------------------------------------------------------------------------
+bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts)
+{
+ if(this->XcodeVersion >= 30)
+ {
+ this->PlatformToolset = ts;
+ return true;
+ }
+ else
+ {
+ return cmGlobalGenerator::SetGeneratorToolset(ts);
+ }
+}
+
+//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
lang,
cmMakefile * mf, bool optional)
@@ -226,6 +240,11 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
mf->AddDefinition("CMAKE_GENERATOR_CC", "gcc");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "g++");
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
+ if(!this->PlatformToolset.empty())
+ {
+ mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
+ this->PlatformToolset.c_str());
+ }
this->cmGlobalGenerator::EnableLanguage(lang, mf, optional);
const char* osxArch =
mf->GetDefinition("CMAKE_OSX_ARCHITECTURES");
@@ -3163,6 +3182,11 @@ void cmGlobalXCodeGenerator
buildSettings->AddAttribute("MACOSX_DEPLOYMENT_TARGET",
this->CreateString(deploymentTarget));
}
+ if(!this->PlatformToolset.empty())
+ {
+ buildSettings->AddAttribute("GCC_VERSION",
+ this->CreateString(this->PlatformToolset.c_str()));
+ }
// Put this last so it can override existing settings
// Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly.
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index c98652f..131a6e6 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -83,6 +83,7 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig();
+ virtual bool SetGeneratorToolset(std::string const& ts);
private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
cmSourceGroup* sg);
@@ -236,6 +237,7 @@ private:
std::map<cmStdString, cmXCodeObject* > TargetGroup;
std::map<cmStdString, cmXCodeObject* > FileRefs;
std::vector<std::string> Architectures;
+ std::string PlatformToolset;
};
#endif
diff --git a/Source/cmake.h b/Source/cmake.h
index dd0eb6b..63065a1 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -542,6 +542,7 @@ private:
"native build system to choose a compiler. " \
"This is supported only on specific generators:\n" \
" Visual Studio >= 10\n" \
+ " Xcode >= 3.0\n" \
"See native build system documentation for allowed toolset names."}, \
{"-Wno-dev", "Suppress developer warnings.",\
"Suppress warnings that are meant for the author"\