Merge topic 'remove-xcode-2'

7373b389 Xcode: Drop support for Xcode versions below 3
eaf53849 Xcode: Compute version number earlier

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Gregor Jasny <gjasny@googlemail.com>
Merge-request: !737
This commit is contained in:
Brad King 2017-04-24 13:40:40 +00:00 committed by Kitware Robot
commit dc6632b9da
14 changed files with 165 additions and 615 deletions

View File

@ -3,6 +3,8 @@ Xcode
Generate Xcode project files. Generate Xcode project files.
This supports Xcode 3.0 and above.
Toolset Selection Toolset Selection
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^

View File

@ -0,0 +1,5 @@
remove-xcode-2
--------------
* The :generator:`Xcode` generator dropped support for Xcode versions
older than 3.

View File

@ -324,18 +324,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
else() else()
set(id_sdkroot "") set(id_sdkroot "")
endif() endif()
if(NOT ${XCODE_VERSION} VERSION_LESS 3) configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
set(v 3) ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
set(ext xcodeproj)
elseif(NOT ${XCODE_VERSION} VERSION_LESS 2)
set(v 2)
set(ext xcodeproj)
else()
set(v 1)
set(ext xcode)
endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-${v}.pbxproj.in
${id_dir}/CompilerId${lang}.${ext}/project.pbxproj @ONLY)
unset(_ENV_MACOSX_DEPLOYMENT_TARGET) unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET}) if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
set(_ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}") set(_ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}")

View File

@ -1,120 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 39;
objects = {
014CEA460018CE2711CA2923 = {
buildSettings = {
};
isa = PBXBuildStyle;
name = Development;
};
08FB7793FE84155DC02AAC07 = {
buildSettings = {
};
buildStyles = (
014CEA460018CE2711CA2923,
);
hasScannedForEncodings = 1;
isa = PBXProject;
mainGroup = 08FB7794FE84155DC02AAC07;
projectDirPath = "";
targets = (
8DD76FA90486AB0100D96B5E,
);
};
08FB7794FE84155DC02AAC07 = {
children = (
08FB7795FE84155DC02AAC07,
1AB674ADFE9D54B511CA2CBB,
);
isa = PBXGroup;
name = CompilerId@id_lang@;
refType = 4;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 = {
children = (
2C18F0B415DC1DC700593670,
);
isa = PBXGroup;
name = Source;
refType = 4;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB = {
children = (
8DD76F6C0486A84900D96B5E,
);
isa = PBXGroup;
name = Products;
refType = 4;
sourceTree = "<group>";
};
2C18F0B415DC1DC700593670 = {
fileEncoding = 30;
isa = PBXFileReference;
explicitFileType = @id_type@;
path = @id_src@;
refType = 4;
sourceTree = "<group>";
};
2C18F0B615DC1E0300593670 = {
fileRef = 2C18F0B415DC1DC700593670;
isa = PBXBuildFile;
settings = {
};
};
2C8FEB8E15DC1A1A00E56A5D = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"GCC_VERSION=$GCC_VERSION\"";
};
8DD76FA90486AB0100D96B5E = {
buildPhases = (
2C18F0B515DC1DCE00593670,
2C8FEB8E15DC1A1A00E56A5D,
);
buildRules = (
);
buildSettings = {
PRODUCT_NAME = CompilerId@id_lang@;
SYMROOT = .;
};
dependencies = (
);
isa = PBXNativeTarget;
name = CompilerId@id_lang@;
productName = CompilerId@id_lang@;
productReference = 8DD76F6C0486A84900D96B5E;
productType = "com.apple.product-type.tool";
};
2C18F0B515DC1DCE00593670 = {
buildActionMask = 2147483647;
files = (
2C18F0B615DC1E0300593670,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
8DD76F6C0486A84900D96B5E = {
explicitFileType = "compiled.mach-o.executable";
includeInIndex = 0;
isa = PBXFileReference;
path = CompilerId@id_lang@;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
};
rootObject = 08FB7793FE84155DC02AAC07;
}

View File

@ -1,119 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; };
2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; explicitFileType = @id_type@; path = @id_src@; sourceTree = "<group>"; };
8DD76F6C0486A84900D96B5E = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CompilerId@id_lang@; sourceTree = BUILT_PRODUCTS_DIR; };
08FB7794FE84155DC02AAC07 = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07,
1AB674ADFE9D54B511CA2CBB,
);
name = CompilerId@id_lang@;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 = {
isa = PBXGroup;
children = (
2C18F0B415DC1DC700593670,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB = {
isa = PBXGroup;
children = (
8DD76F6C0486A84900D96B5E,
);
name = Products;
sourceTree = "<group>";
};
8DD76FA90486AB0100D96B5E = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB928508733DD80010E9CD;
buildPhases = (
2C18F0B515DC1DCE00593670,
2C8FEB8E15DC1A1A00E56A5D,
);
buildRules = (
);
dependencies = (
);
name = CompilerId@id_lang@;
productName = CompilerId@id_lang@;
productReference = 8DD76F6C0486A84900D96B5E;
productType = "com.apple.product-type.tool";
};
08FB7793FE84155DC02AAC07 = {
isa = PBXProject;
buildConfigurationList = 1DEB928908733DD80010E9CD;
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07;
projectDirPath = "";
targets = (
8DD76FA90486AB0100D96B5E,
);
};
2C8FEB8E15DC1A1A00E56A5D = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"GCC_VERSION=$GCC_VERSION\"";
};
2C18F0B515DC1DCE00593670 = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2C18F0B615DC1E0300593670,
);
runOnlyForDeploymentPostprocessing = 0;
};
1DEB928608733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = CompilerId@id_lang@;
};
name = Debug;
};
1DEB928A08733DD80010E9CD = {
isa = XCBuildConfiguration;
buildSettings = {
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .;
};
name = Debug;
};
1DEB928508733DD80010E9CD = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB928608733DD80010E9CD,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
1DEB928908733DD80010E9CD = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB928A08733DD80010E9CD,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
};
rootObject = 08FB7793FE84155DC02AAC07;
}

View File

@ -133,16 +133,12 @@ public:
bool SupportsPlatform() const CM_OVERRIDE { return false; } bool SupportsPlatform() const CM_OVERRIDE { return false; }
}; };
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm, cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(
std::string const& version) cmake* cm, std::string const& version_string, unsigned int version_number)
: cmGlobalGenerator(cm) : cmGlobalGenerator(cm)
{ {
this->VersionString = version; this->VersionString = version_string;
this->XcodeVersion = version_number;
// Compute an integer form of the version number.
unsigned int v[2] = { 0, 0 };
sscanf(this->VersionString.c_str(), "%u.%u", &v[0], &v[1]);
this->XcodeVersion = 10 * v[0] + v[1];
this->RootObject = 0; this->RootObject = 0;
this->MainGroupChildren = 0; this->MainGroupChildren = 0;
@ -189,13 +185,21 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
parser.ParseFile( parser.ParseFile(
"/Developer/Applications/Xcode.app/Contents/version.plist"); "/Developer/Applications/Xcode.app/Contents/version.plist");
} }
CM_AUTO_PTR<cmGlobalXCodeGenerator> gg( std::string const& version_string = parser.Version;
new cmGlobalXCodeGenerator(cm, parser.Version));
if (gg->XcodeVersion == 20) { // Compute an integer form of the version number.
cmSystemTools::Message("Xcode 2.0 not really supported by cmake, " unsigned int v[2] = { 0, 0 };
"using Xcode 15 generator\n"); sscanf(version_string.c_str(), "%u.%u", &v[0], &v[1]);
gg->XcodeVersion = 15; unsigned int version_number = 10 * v[0] + v[1];
if (version_number < 30) {
cm->IssueMessage(cmake::FATAL_ERROR,
"Xcode " + version_string + " not supported.");
return CM_NULLPTR;
} }
CM_AUTO_PTR<cmGlobalXCodeGenerator> gg(
new cmGlobalXCodeGenerator(cm, version_string, version_number));
return gg.release(); return gg.release();
#else #else
std::cerr << "CMake should be built with cmake to use Xcode, " std::cerr << "CMake should be built with cmake to use Xcode, "
@ -242,29 +246,25 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf) cmMakefile* mf)
{ {
if (this->XcodeVersion >= 30) { if (ts.find_first_of(",=") != ts.npos) {
if (ts.find_first_of(",=") != ts.npos) { std::ostringstream e;
std::ostringstream e; /* clang-format off */
/* clang-format off */ e <<
e << "Generator\n"
"Generator\n" " " << this->GetName() << "\n"
" " << this->GetName() << "\n" "does not recognize the toolset\n"
"does not recognize the toolset\n" " " << ts << "\n"
" " << ts << "\n" "that was specified.";
"that was specified."; /* clang-format on */
/* clang-format on */ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false;
return false;
}
this->GeneratorToolset = ts;
if (!this->GeneratorToolset.empty()) {
mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
this->GeneratorToolset.c_str());
}
return true;
} else {
return cmGlobalGenerator::SetGeneratorToolset(ts, mf);
} }
this->GeneratorToolset = ts;
if (!this->GeneratorToolset.empty()) {
mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
this->GeneratorToolset.c_str());
}
return true;
} }
void cmGlobalXCodeGenerator::EnableLanguage( void cmGlobalXCodeGenerator::EnableLanguage(
@ -272,16 +272,13 @@ void cmGlobalXCodeGenerator::EnableLanguage(
{ {
mf->AddDefinition("XCODE", "1"); mf->AddDefinition("XCODE", "1");
mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str()); mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str());
if (this->XcodeVersion == 15) { if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
} else { mf->AddCacheDefinition(
if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo",
mf->AddCacheDefinition( "Semicolon separated list of supported configuration types, "
"CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo", "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
"Semicolon separated list of supported configuration types, " "anything else will be ignored.",
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " cmStateEnums::STRING);
"anything else will be ignored.",
cmStateEnums::STRING);
}
} }
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); this->cmGlobalGenerator::EnableLanguage(lang, mf, optional);
@ -301,9 +298,7 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand(
makeCommand.push_back("-project"); makeCommand.push_back("-project");
std::string projectArg = projectName; std::string projectArg = projectName;
projectArg += ".xcode"; projectArg += ".xcode";
if (this->XcodeVersion > 20) { projectArg += "proj";
projectArg += "proj";
}
makeCommand.push_back(projectArg); makeCommand.push_back(projectArg);
bool clean = false; bool clean = false;
@ -323,13 +318,8 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand(
} else { } else {
makeCommand.push_back("ALL_BUILD"); makeCommand.push_back("ALL_BUILD");
} }
if (this->XcodeVersion == 15) { makeCommand.push_back("-configuration");
makeCommand.push_back("-buildstyle"); makeCommand.push_back(!config.empty() ? config : "Debug");
makeCommand.push_back("Development");
} else {
makeCommand.push_back("-configuration");
makeCommand.push_back(!config.empty() ? config : "Debug");
}
makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeCommand.insert(makeCommand.end(), makeOptions.begin(),
makeOptions.end()); makeOptions.end());
} }
@ -391,9 +381,7 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget(
std::string target = tName; std::string target = tName;
std::replace(target.begin(), target.end(), ' ', '_'); std::replace(target.begin(), target.end(), ' ', '_');
std::string out = "PostBuild." + target; std::string out = "PostBuild." + target;
if (this->XcodeVersion > 20) { out += "." + configName;
out += "." + configName;
}
return out; return out;
} }
@ -603,12 +591,7 @@ void cmGlobalXCodeGenerator::addObject(cmXCodeObject* obj)
cmXCodeObject* cmGlobalXCodeGenerator::CreateObject( cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(
cmXCodeObject::PBXType ptype) cmXCodeObject::PBXType ptype)
{ {
cmXCodeObject* obj; cmXCodeObject* obj = new cmXCode21Object(ptype, cmXCodeObject::OBJECT);
if (this->XcodeVersion == 15) {
obj = new cmXCodeObject(ptype, cmXCodeObject::OBJECT);
} else {
obj = new cmXCode21Object(ptype, cmXCodeObject::OBJECT);
}
this->addObject(obj); this->addObject(obj);
return obj; return obj;
} }
@ -894,9 +877,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
fileRef->AddAttribute("name", this->CreateString(name)); fileRef->AddAttribute("name", this->CreateString(name));
fileRef->AddAttribute("path", this->CreateString(path)); fileRef->AddAttribute("path", this->CreateString(path));
fileRef->AddAttribute("sourceTree", this->CreateString(sourceTree)); fileRef->AddAttribute("sourceTree", this->CreateString(sourceTree));
if (this->XcodeVersion == 15) {
fileRef->AddAttribute("refType", this->CreateString("4"));
}
return fileRef; return fileRef;
} }
@ -1561,9 +1541,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
std::vector<cmCustomCommand> const& commands, const std::string& configName) std::vector<cmCustomCommand> const& commands, const std::string& configName)
{ {
std::string makefileName = makefileBasename; std::string makefileName = makefileBasename;
if (this->XcodeVersion > 20) { makefileName += configName;
makefileName += configName;
}
cmGeneratedFileStream makefileStream(makefileName.c_str()); cmGeneratedFileStream makefileStream(makefileName.c_str());
if (!makefileStream) { if (!makefileStream) {
return; return;
@ -1712,11 +1690,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
defFlags, this->CurrentMakefile->GetDefineFlags()); defFlags, this->CurrentMakefile->GetDefineFlags());
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
BuildObjectListOrString ppDefs(this, this->XcodeVersion >= 30); BuildObjectListOrString ppDefs(this, true);
if (this->XcodeVersion > 15) { this->AppendDefines(
this->AppendDefines( ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
}
if (const char* exportMacro = gtgt->GetExportMacro()) { if (const char* exportMacro = gtgt->GetExportMacro()) {
// Add the export symbol definition for shared library objects. // Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro); this->AppendDefines(ppDefs, exportMacro);
@ -1816,16 +1792,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
gtgt->GetType() == cmStateEnums::SHARED_LIBRARY || gtgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gtgt->GetType() == cmStateEnums::MODULE_LIBRARY || gtgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
gtgt->GetType() == cmStateEnums::EXECUTABLE) { gtgt->GetType() == cmStateEnums::EXECUTABLE) {
if (this->XcodeVersion >= 21) { if (!gtgt->UsesDefaultOutputDir(configName,
if (!gtgt->UsesDefaultOutputDir(configName, cmStateEnums::RuntimeBinaryArtifact)) {
cmStateEnums::RuntimeBinaryArtifact)) { std::string pncdir = gtgt->GetDirectory(configName);
std::string pncdir = gtgt->GetDirectory(configName); buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", this->CreateString(pncdir));
this->CreateString(pncdir));
}
} else {
buildSettings->AddAttribute("OBJROOT", this->CreateString(pndir));
pndir = gtgt->GetDirectory(configName);
} }
if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) { if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) {
@ -1841,16 +1812,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
pnbase = gtgt->GetName(); pnbase = gtgt->GetName();
pnsuffix = ".a"; pnsuffix = ".a";
if (this->XcodeVersion >= 21) { std::string pncdir =
std::string pncdir = this->GetObjectsNormalDirectory( this->GetObjectsNormalDirectory(this->CurrentProject, configName, gtgt);
this->CurrentProject, configName, gtgt); buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", this->CreateString(pncdir));
this->CreateString(pncdir));
} else {
buildSettings->AddAttribute("OBJROOT", this->CreateString(pndir));
pndir = this->GetObjectsNormalDirectory(this->CurrentProject, configName,
gtgt);
}
} }
// Store the product name for all target types. // Store the product name for all target types.
@ -1919,7 +1884,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
buildSettings->AddAttribute("INFOPLIST_FILE", buildSettings->AddAttribute("INFOPLIST_FILE",
this->CreateString(plist)); this->CreateString(plist));
} else if (this->XcodeVersion >= 22) { } else {
buildSettings->AddAttribute("MACH_O_TYPE", buildSettings->AddAttribute("MACH_O_TYPE",
this->CreateString("mh_bundle")); this->CreateString("mh_bundle"));
buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC", buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC",
@ -1931,14 +1896,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
extraLinkOptions += " "; extraLinkOptions += " ";
extraLinkOptions += createFlags; extraLinkOptions += createFlags;
} }
} else {
// Add the flags to create a module.
std::string createFlags = this->LookupFlags(
"CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", "-bundle");
if (!createFlags.empty()) {
extraLinkOptions += " ";
extraLinkOptions += createFlags;
}
} }
break; break;
} }
@ -2004,14 +1961,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
default: default:
break; break;
} }
if (this->XcodeVersion >= 22 && this->XcodeVersion < 40) { if (this->XcodeVersion < 40) {
buildSettings->AddAttribute("PREBINDING", this->CreateString("NO")); buildSettings->AddAttribute("PREBINDING", this->CreateString("NO"));
} }
BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); BuildObjectListOrString dirs(this, true);
BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); BuildObjectListOrString fdirs(this, true);
BuildObjectListOrString sysdirs(this, this->XcodeVersion >= 30); BuildObjectListOrString sysdirs(this, true);
BuildObjectListOrString sysfdirs(this, this->XcodeVersion >= 30); BuildObjectListOrString sysfdirs(this, true);
const bool emitSystemIncludes = this->XcodeVersion >= 83; const bool emitSystemIncludes = this->XcodeVersion >= 83;
std::vector<std::string> includes; std::vector<std::string> includes;
@ -2242,18 +2199,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
buildSettings->AddAttribute("OTHER_REZFLAGS", this->CreateString("")); buildSettings->AddAttribute("OTHER_REZFLAGS", this->CreateString(""));
buildSettings->AddAttribute("SECTORDER_FLAGS", this->CreateString("")); buildSettings->AddAttribute("SECTORDER_FLAGS", this->CreateString(""));
buildSettings->AddAttribute("USE_HEADERMAP", this->CreateString("NO")); buildSettings->AddAttribute("USE_HEADERMAP", this->CreateString("NO"));
if (this->XcodeVersion >= 30) { cmXCodeObject* group = this->CreateObject(cmXCodeObject::OBJECT_LIST);
cmXCodeObject* group = this->CreateObject(cmXCodeObject::OBJECT_LIST); group->AddObject(this->CreateString("-Wmost"));
group->AddObject(this->CreateString("-Wmost")); group->AddObject(this->CreateString("-Wno-four-char-constants"));
group->AddObject(this->CreateString("-Wno-four-char-constants")); group->AddObject(this->CreateString("-Wno-unknown-pragmas"));
group->AddObject(this->CreateString("-Wno-unknown-pragmas")); group->AddObject(this->CreateString("$(inherited)"));
group->AddObject(this->CreateString("$(inherited)")); buildSettings->AddAttribute("WARNING_CFLAGS", group);
buildSettings->AddAttribute("WARNING_CFLAGS", group);
} else {
buildSettings->AddAttribute(
"WARNING_CFLAGS", this->CreateString("-Wmost -Wno-four-char-constants"
" -Wno-unknown-pragmas"));
}
// Runtime version information. // Runtime version information.
if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) { if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
@ -2333,16 +2284,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0, this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0,
gtgt); gtgt);
target->AddAttribute("buildPhases", buildPhases); target->AddAttribute("buildPhases", buildPhases);
if (this->XcodeVersion > 20) { this->AddConfigurations(target, gtgt);
this->AddConfigurations(target, gtgt);
} else {
std::string theConfig =
this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
this->CreateBuildSettings(gtgt, buildSettings, theConfig);
target->AddAttribute("buildSettings", buildSettings);
}
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies); target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(gtgt->GetName())); target->AddAttribute("name", this->CreateString(gtgt->GetName()));
@ -2444,8 +2386,7 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
else if (target->IsCFBundleOnApple()) else if (target->IsCFBundleOnApple())
return "wrapper.plug-in"; return "wrapper.plug-in";
else else
return ((this->XcodeVersion >= 22) ? "compiled.mach-o.executable" return "compiled.mach-o.executable";
: "compiled.mach-o.dylib");
case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK") return (target->GetPropertyAsBool("FRAMEWORK")
? "wrapper.framework" ? "wrapper.framework"
@ -2478,9 +2419,7 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(
else if (target->IsCFBundleOnApple()) else if (target->IsCFBundleOnApple())
return "com.apple.product-type.bundle"; return "com.apple.product-type.bundle";
else else
return ((this->XcodeVersion >= 22) return "com.apple.product-type.tool";
? "com.apple.product-type.tool"
: "com.apple.product-type.library.dynamic");
case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK") return (target->GetPropertyAsBool("FRAMEWORK")
? "com.apple.product-type.framework" ? "com.apple.product-type.framework"
@ -2506,15 +2445,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
cmXCodeObject* buildRules = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* buildRules = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("buildRules", buildRules); target->AddAttribute("buildRules", buildRules);
std::string defConfig; std::string defConfig;
if (this->XcodeVersion > 20) { defConfig = this->AddConfigurations(target, gtgt);
defConfig = this->AddConfigurations(target, gtgt);
} else {
cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
defConfig = this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->CreateBuildSettings(gtgt, buildSettings, defConfig);
target->AddAttribute("buildSettings", buildSettings);
}
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies); target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(gtgt->GetName())); target->AddAttribute("name", this->CreateString(gtgt->GetName()));
@ -2533,9 +2464,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
fullName = gtgt->GetFullName(defConfig); fullName = gtgt->GetFullName(defConfig);
} }
fileRef->AddAttribute("path", this->CreateString(fullName)); fileRef->AddAttribute("path", this->CreateString(fullName));
if (this->XcodeVersion == 15) {
fileRef->AddAttribute("refType", this->CreateString("0"));
}
fileRef->AddAttribute("sourceTree", fileRef->AddAttribute("sourceTree",
this->CreateString("BUILT_PRODUCTS_DIR")); this->CreateString("BUILT_PRODUCTS_DIR"));
fileRef->SetComment(gtgt->GetName()); fileRef->SetComment(gtgt->GetName());
@ -2636,32 +2564,25 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
cmXCodeObject* target, const char* attribute, const char* value, cmXCodeObject* target, const char* attribute, const char* value,
const std::string& configName) const std::string& configName)
{ {
if (this->XcodeVersion < 21) { // There are multiple configurations. Add the setting to the
// There is only one configuration. Add the setting to the buildSettings // buildSettings of the configuration name given.
// of the target. cmXCodeObject* configurationList =
this->AppendOrAddBuildSetting(target->GetObject("buildSettings"), target->GetObject("buildConfigurationList")->GetObject();
attribute, value); cmXCodeObject* buildConfigs =
} else { configurationList->GetObject("buildConfigurations");
// There are multiple configurations. Add the setting to the std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList();
// buildSettings of the configuration name given. // each configuration and the target itself has a buildSettings in it
cmXCodeObject* configurationList = // list.push_back(target);
target->GetObject("buildConfigurationList")->GetObject(); for (std::vector<cmXCodeObject*>::iterator i = list.begin(); i != list.end();
cmXCodeObject* buildConfigs = ++i) {
configurationList->GetObject("buildConfigurations"); if (!configName.empty()) {
std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList(); if ((*i)->GetObject("name")->GetString() == configName) {
// each configuration and the target itself has a buildSettings in it
// list.push_back(target);
for (std::vector<cmXCodeObject*>::iterator i = list.begin();
i != list.end(); ++i) {
if (!configName.empty()) {
if ((*i)->GetObject("name")->GetString() == configName) {
cmXCodeObject* settings = (*i)->GetObject("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value);
}
} else {
cmXCodeObject* settings = (*i)->GetObject("buildSettings"); cmXCodeObject* settings = (*i)->GetObject("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value); this->AppendOrAddBuildSetting(settings, attribute, value);
} }
} else {
cmXCodeObject* settings = (*i)->GetObject("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value);
} }
} }
} }
@ -2741,13 +2662,11 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
for (std::vector<std::string>::const_iterator libDir = libDirs.begin(); for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
libDir != libDirs.end(); ++libDir) { libDir != libDirs.end(); ++libDir) {
if (libDir->size() && *libDir != "/usr/lib") { if (libDir->size() && *libDir != "/usr/lib") {
if (this->XcodeVersion > 15) { // Now add the same one but append
// Now add the same one but append // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
// $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it: linkDirs += " ";
linkDirs += " "; linkDirs += this->XCodeEscapePath(
linkDirs += this->XCodeEscapePath( *libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
*libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
}
linkDirs += " "; linkDirs += " ";
linkDirs += this->XCodeEscapePath(*libDir); linkDirs += this->XCodeEscapePath(*libDir);
} }
@ -2849,9 +2768,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent,
this->CreateObject(cmXCodeObject::OBJECT_LIST); this->CreateObject(cmXCodeObject::OBJECT_LIST);
group->AddAttribute("name", this->CreateString(name)); group->AddAttribute("name", this->CreateString(name));
group->AddAttribute("children", groupChildren); group->AddAttribute("children", groupChildren);
if (this->XcodeVersion == 15) {
group->AddAttribute("refType", this->CreateString("4"));
}
group->AddAttribute("sourceTree", this->CreateString("<group>")); group->AddAttribute("sourceTree", this->CreateString("<group>"));
if (parentChildren) if (parentChildren)
parentChildren->AddObject(group); parentChildren->AddObject(group);
@ -2950,50 +2866,28 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->MainGroupChildren = 0; this->MainGroupChildren = 0;
cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO")); group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
cmXCodeObject* developBuildStyle =
this->CreateObject(cmXCodeObject::PBXBuildStyle);
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
if (this->XcodeVersion == 15) { for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
developBuildStyle->AddAttribute("name", this->CreateString("Development")); cmXCodeObject* buildStyle =
developBuildStyle->AddAttribute("buildSettings", group);
listObjs->AddObject(developBuildStyle);
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("YES"));
cmXCodeObject* deployBuildStyle =
this->CreateObject(cmXCodeObject::PBXBuildStyle); this->CreateObject(cmXCodeObject::PBXBuildStyle);
deployBuildStyle->AddAttribute("name", this->CreateString("Deployment")); const char* name = this->CurrentConfigurationTypes[i].c_str();
deployBuildStyle->AddAttribute("buildSettings", group); buildStyle->AddAttribute("name", this->CreateString(name));
listObjs->AddObject(deployBuildStyle); buildStyle->SetComment(name);
} else { cmXCodeObject* sgroup = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) { sgroup->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
cmXCodeObject* buildStyle = buildStyle->AddAttribute("buildSettings", sgroup);
this->CreateObject(cmXCodeObject::PBXBuildStyle); listObjs->AddObject(buildStyle);
const char* name = this->CurrentConfigurationTypes[i].c_str();
buildStyle->AddAttribute("name", this->CreateString(name));
buildStyle->SetComment(name);
cmXCodeObject* sgroup =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
sgroup->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
buildStyle->AddAttribute("buildSettings", sgroup);
listObjs->AddObject(buildStyle);
}
} }
cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup); cmXCodeObject* mainGroup = this->CreateObject(cmXCodeObject::PBXGroup);
this->MainGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); this->MainGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST);
mainGroup->AddAttribute("children", this->MainGroupChildren); mainGroup->AddAttribute("children", this->MainGroupChildren);
if (this->XcodeVersion == 15) {
mainGroup->AddAttribute("refType", this->CreateString("4"));
}
mainGroup->AddAttribute("sourceTree", this->CreateString("<group>")); mainGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup); cmXCodeObject* sourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup);
this->SourcesGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); this->SourcesGroupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST);
sourcesGroup->AddAttribute("name", this->CreateString("Sources")); sourcesGroup->AddAttribute("name", this->CreateString("Sources"));
sourcesGroup->AddAttribute("children", this->SourcesGroupChildren); sourcesGroup->AddAttribute("children", this->SourcesGroupChildren);
if (this->XcodeVersion == 15) {
sourcesGroup->AddAttribute("refType", this->CreateString("4"));
}
sourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>")); sourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
this->MainGroupChildren->AddObject(sourcesGroup); this->MainGroupChildren->AddObject(sourcesGroup);
@ -3002,9 +2896,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->CreateObject(cmXCodeObject::OBJECT_LIST); this->CreateObject(cmXCodeObject::OBJECT_LIST);
resourcesGroup->AddAttribute("name", this->CreateString("Resources")); resourcesGroup->AddAttribute("name", this->CreateString("Resources"));
resourcesGroup->AddAttribute("children", this->ResourcesGroupChildren); resourcesGroup->AddAttribute("children", this->ResourcesGroupChildren);
if (this->XcodeVersion == 15) {
resourcesGroup->AddAttribute("refType", this->CreateString("4"));
}
resourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>")); resourcesGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
this->MainGroupChildren->AddObject(resourcesGroup); this->MainGroupChildren->AddObject(resourcesGroup);
@ -3015,9 +2906,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup); cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
productGroup->AddAttribute("name", this->CreateString("Products")); productGroup->AddAttribute("name", this->CreateString("Products"));
if (this->XcodeVersion == 15) {
productGroup->AddAttribute("refType", this->CreateString("4"));
}
productGroup->AddAttribute("sourceTree", this->CreateString("<group>")); productGroup->AddAttribute("sourceTree", this->CreateString("<group>"));
cmXCodeObject* productGroupChildren = cmXCodeObject* productGroupChildren =
this->CreateObject(cmXCodeObject::OBJECT_LIST); this->CreateObject(cmXCodeObject::OBJECT_LIST);
@ -3039,24 +2927,22 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->RootObject->AddAttribute("buildStyles", listObjs); this->RootObject->AddAttribute("buildStyles", listObjs);
this->RootObject->AddAttribute("hasScannedForEncodings", this->RootObject->AddAttribute("hasScannedForEncodings",
this->CreateString("0")); this->CreateString("0"));
if (this->XcodeVersion >= 30) { group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); group->AddAttribute("BuildIndependentTargetsInParallel",
group->AddAttribute("BuildIndependentTargetsInParallel", this->CreateString("YES"));
this->CreateString("YES")); std::ostringstream v;
std::ostringstream v; v << std::setfill('0') << std::setw(4) << XcodeVersion * 10;
v << std::setfill('0') << std::setw(4) << XcodeVersion * 10; group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str()));
group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str())); this->RootObject->AddAttribute("attributes", group);
this->RootObject->AddAttribute("attributes", group); if (this->XcodeVersion >= 32)
if (this->XcodeVersion >= 32) this->RootObject->AddAttribute("compatibilityVersion",
this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.2"));
this->CreateString("Xcode 3.2")); else if (this->XcodeVersion >= 31)
else if (this->XcodeVersion >= 31) this->RootObject->AddAttribute("compatibilityVersion",
this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.1"));
this->CreateString("Xcode 3.1")); else
else this->RootObject->AddAttribute("compatibilityVersion",
this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.0"));
this->CreateString("Xcode 3.0"));
}
// Point Xcode at the top of the source tree. // Point Xcode at the top of the source tree.
{ {
std::string pdir = std::string pdir =
@ -3071,26 +2957,15 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
typedef std::vector<std::pair<std::string, cmXCodeObject*> > Configs; typedef std::vector<std::pair<std::string, cmXCodeObject*> > Configs;
Configs configs; Configs configs;
const char* defaultConfigName = "Debug"; const char* defaultConfigName = "Debug";
if (this->XcodeVersion == 15) { for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
cmXCodeObject* configDebug = const char* name = this->CurrentConfigurationTypes[i].c_str();
this->CreateObject(cmXCodeObject::XCBuildConfiguration); if (0 == i) {
configDebug->AddAttribute("name", this->CreateString("Debug")); defaultConfigName = name;
configs.push_back(std::make_pair("Debug", configDebug));
cmXCodeObject* configRelease =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
configRelease->AddAttribute("name", this->CreateString("Release"));
configs.push_back(std::make_pair("Release", configRelease));
} else {
for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
const char* name = this->CurrentConfigurationTypes[i].c_str();
if (0 == i) {
defaultConfigName = name;
}
cmXCodeObject* config =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
config->AddAttribute("name", this->CreateString(name));
configs.push_back(std::make_pair(name, config));
} }
cmXCodeObject* config =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
config->AddAttribute("name", this->CreateString(name));
configs.push_back(std::make_pair(name, config));
} }
for (Configs::iterator c = configs.begin(); c != configs.end(); ++c) { for (Configs::iterator c = configs.begin(); c != configs.end(); ++c) {
buildConfigurations->AddObject(c->second); buildConfigurations->AddObject(c->second);
@ -3247,22 +3122,12 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
void cmGlobalXCodeGenerator::ComputeObjectDirArch() void cmGlobalXCodeGenerator::ComputeObjectDirArch()
{ {
if (this->XcodeVersion >= 21) { if (this->Architectures.size() > 1) {
if (this->Architectures.size() > 1) { this->ObjectDirArch = "$(CURRENT_ARCH)";
this->ObjectDirArch = "$(CURRENT_ARCH)"; } else if (!this->Architectures.empty()) {
} else if (!this->Architectures.empty()) { this->ObjectDirArch = this->Architectures[0];
this->ObjectDirArch = this->Architectures[0];
} else {
this->ObjectDirArch = this->ObjectDirArchDefault;
}
} else { } else {
#if defined(__ppc__) this->ObjectDirArch = this->ObjectDirArchDefault;
this->ObjectDirArch = "ppc";
#elif defined(__i386)
this->ObjectDirArch = "i386";
#else
this->ObjectDirArch = "";
#endif
} }
} }
@ -3432,10 +3297,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
std::string xcodeDir = root->GetCurrentBinaryDirectory(); std::string xcodeDir = root->GetCurrentBinaryDirectory();
xcodeDir += "/"; xcodeDir += "/";
xcodeDir += root->GetProjectName(); xcodeDir += root->GetProjectName();
xcodeDir += ".xcode"; xcodeDir += ".xcodeproj";
if (this->XcodeVersion > 20) {
xcodeDir += "proj";
}
cmSystemTools::MakeDirectory(xcodeDir.c_str()); cmSystemTools::MakeDirectory(xcodeDir.c_str());
std::string xcodeProjFile = xcodeDir + "/project.pbxproj"; std::string xcodeProjFile = xcodeDir + "/project.pbxproj";
cmGeneratedFileStream fout(xcodeProjFile.c_str()); cmGeneratedFileStream fout(xcodeProjFile.c_str());
@ -3524,20 +3386,13 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmXCodeObject::Indent(1, fout); cmXCodeObject::Indent(1, fout);
fout << "};\n"; fout << "};\n";
cmXCodeObject::Indent(1, fout); cmXCodeObject::Indent(1, fout);
if (this->XcodeVersion >= 21) { if (this->XcodeVersion >= 32)
if (this->XcodeVersion >= 32) fout << "objectVersion = 46;\n";
fout << "objectVersion = 46;\n"; else if (this->XcodeVersion >= 31)
else if (this->XcodeVersion >= 31) fout << "objectVersion = 45;\n";
fout << "objectVersion = 45;\n"; else
else if (this->XcodeVersion >= 30) fout << "objectVersion = 44;\n";
fout << "objectVersion = 44;\n"; cmXCode21Object::PrintList(this->XCodeObjects, fout);
else
fout << "objectVersion = 42;\n";
cmXCode21Object::PrintList(this->XCodeObjects, fout);
} else {
fout << "objectVersion = 39;\n";
cmXCodeObject::PrintList(this->XCodeObjects, fout);
}
cmXCodeObject::Indent(1, fout); cmXCodeObject::Indent(1, fout);
fout << "rootObject = " << this->RootObject->GetId() fout << "rootObject = " << this->RootObject->GetId()
<< " /* Project object */;\n"; << " /* Project object */;\n";
@ -3546,9 +3401,7 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const
{ {
return this->XcodeVersion >= 21 return "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
? "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"
: ".";
} }
std::string cmGlobalXCodeGenerator::ExpandCFGIntDir( std::string cmGlobalXCodeGenerator::ExpandCFGIntDir(
@ -3611,12 +3464,10 @@ void cmGlobalXCodeGenerator::AppendDirectoryForConfig(
const std::string& prefix, const std::string& config, const std::string& prefix, const std::string& config,
const std::string& suffix, std::string& dir) const std::string& suffix, std::string& dir)
{ {
if (this->XcodeVersion > 20) { if (!config.empty()) {
if (!config.empty()) { dir += prefix;
dir += prefix; dir += config;
dir += config; dir += suffix;
dir += suffix;
}
} }
} }
@ -3741,11 +3592,6 @@ std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation(
// i.e. "Can I build Debug and Release in the same tree?" // i.e. "Can I build Debug and Release in the same tree?"
bool cmGlobalXCodeGenerator::IsMultiConfig() const bool cmGlobalXCodeGenerator::IsMultiConfig() const
{ {
// Old Xcode 1.5 is single config:
if (this->XcodeVersion == 15) {
return false;
}
// Newer Xcode versions are multi config: // Newer Xcode versions are multi config:
return true; return true;
} }

View File

@ -32,7 +32,8 @@ struct cmDocumentationEntry;
class cmGlobalXCodeGenerator : public cmGlobalGenerator class cmGlobalXCodeGenerator : public cmGlobalGenerator
{ {
public: public:
cmGlobalXCodeGenerator(cmake* cm, std::string const& version); cmGlobalXCodeGenerator(cmake* cm, std::string const& version_string,
unsigned int version_number);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
///! Get the name for the generator. ///! Get the name for the generator.

View File

@ -34,16 +34,6 @@ target_link_libraries(CMakeLibTests CMakeLib)
add_executable(testEncoding testEncoding.cxx) add_executable(testEncoding testEncoding.cxx)
target_link_libraries(testEncoding cmsys) target_link_libraries(testEncoding cmsys)
# Xcode 2.x forgets to create the output directory before linking
# the individual architectures.
if(CMAKE_OSX_ARCHITECTURES AND XCODE
AND NOT "${XCODE_VERSION}" MATCHES "^[^12]")
add_custom_command(
TARGET CMakeLibTests
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
)
endif()
foreach(test ${CMakeLib_TESTS}) foreach(test ${CMakeLib_TESTS})
add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS}) add_test(CMakeLib.${test} CMakeLibTests ${test} ${${test}_ARGS})
endforeach() endforeach()

View File

@ -24,18 +24,3 @@ target_link_libraries(memcheck_fail CMakeLib)
# output file. Need to be in their own subdirectory as they have the # output file. Need to be in their own subdirectory as they have the
# same filenames. # same filenames.
add_subdirectory(NoLog) add_subdirectory(NoLog)
# Xcode 2.x forgets to create the output directory before linking
# the individual architectures.
if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]")
foreach(t
memcheck_fail
pseudo_BC
pseudo_purify
pseudo_valgrind
)
add_custom_command(TARGET ${t}
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
)
endforeach()
endif()

View File

@ -11,12 +11,4 @@ configure_file(
foreach(_pseudo IN ITEMS valgrind purify BC) foreach(_pseudo IN ITEMS valgrind purify BC)
add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c")
set_target_properties(pseudonl_${_pseudo} PROPERTIES OUTPUT_NAME ${_pseudo}) set_target_properties(pseudonl_${_pseudo} PROPERTIES OUTPUT_NAME ${_pseudo})
# Xcode 2.x forgets to create the output directory before linking
# the individual architectures.
if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]")
add_custom_command(TARGET pseudonl_${_pseudo}
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
)
endif()
endforeach() endforeach()

View File

@ -63,15 +63,6 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1)
set(Swift_ARGS -DXCODE_BELOW_6_1=1) set(Swift_ARGS -DXCODE_BELOW_6_1=1)
endif() endif()
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1)
endif()
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2)
set(TargetSources_ARGS -DXCODE_BELOW_2=1)
set(File_Generate_ARGS -DXCODE_BELOW_2=1)
endif()
# Test MSVC for older host CMake versions, and test # Test MSVC for older host CMake versions, and test
# WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows. # WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows.
if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel")) if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel"))
@ -284,7 +275,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^89]|[89][0-9])")
add_RunCMake_test(VS10Project) add_RunCMake_test(VS10Project)
endif() endif()
if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3) if(XCODE_VERSION)
add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}) add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION})
endif() endif()
@ -332,19 +323,6 @@ add_executable(pseudo_emulator_custom_command pseudo_emulator_custom_command.c)
add_RunCMake_test(CrosscompilingEmulator add_RunCMake_test(CrosscompilingEmulator
-DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator> -DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator>
-DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command>) -DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command>)
# Xcode 2.x forgets to create the output directory before linking
# the individual architectures.
if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]")
add_custom_command(
TARGET pseudo_emulator
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
)
add_custom_command(
TARGET pseudo_emulator_custom_command
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
)
endif()
if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
if(UNIX AND NOT CYGWIN) if(UNIX AND NOT CYGWIN)
execute_process(COMMAND ldd --help execute_process(COMMAND ldd --help

View File

@ -1,7 +1,7 @@
include(RunCMake) include(RunCMake)
run_cmake(CommandConflict) run_cmake(CommandConflict)
if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode")
run_cmake(OutputConflict) run_cmake(OutputConflict)
endif() endif()
run_cmake(EmptyCondition1) run_cmake(EmptyCondition1)

View File

@ -31,7 +31,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]")
endif() endif()
set(RunCMake_GENERATOR_TOOLSET "Test Toolset,not_a_key") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,not_a_key")
run_cmake(BadToolsetFormat) run_cmake(BadToolsetFormat)
elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode" AND NOT XCODE_BELOW_3) elseif("${RunCMake_GENERATOR}" STREQUAL "Xcode")
set(RunCMake_GENERATOR_TOOLSET "Test Toolset") set(RunCMake_GENERATOR_TOOLSET "Test Toolset")
run_cmake(TestToolset) run_cmake(TestToolset)
set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64")
@ -47,7 +47,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset")
run_cmake(TwoToolsets) run_cmake(TwoToolsets)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)
if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode" AND NOT XCODE_BELOW_3) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode")
set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake)
run_cmake(TestToolsetToolchain) run_cmake(TestToolsetToolchain)
unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OPTIONS)

View File

@ -1,6 +1,6 @@
include(RunCMake) include(RunCMake)
if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND NOT XCODE_BELOW_2) if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode")
run_cmake(ConfigNotAllowed) run_cmake(ConfigNotAllowed)
run_cmake(OriginDebugIDE) run_cmake(OriginDebugIDE)
else() else()