Xcode: Compute version number earlier

This commit is contained in:
Brad King
2017-04-21 13:08:30 -04:00
parent 294cf948dc
commit eaf53849ec
2 changed files with 14 additions and 10 deletions

View File

@@ -133,16 +133,12 @@ public:
bool SupportsPlatform() const CM_OVERRIDE { return false; }
};
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm,
std::string const& version)
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(
cmake* cm, std::string const& version_string, unsigned int version_number)
: cmGlobalGenerator(cm)
{
this->VersionString = version;
// 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->VersionString = version_string;
this->XcodeVersion = version_number;
this->RootObject = 0;
this->MainGroupChildren = 0;
@@ -189,8 +185,15 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
parser.ParseFile(
"/Developer/Applications/Xcode.app/Contents/version.plist");
}
std::string const& version_string = parser.Version;
// Compute an integer form of the version number.
unsigned int v[2] = { 0, 0 };
sscanf(version_string.c_str(), "%u.%u", &v[0], &v[1]);
unsigned int version_number = 10 * v[0] + v[1];
CM_AUTO_PTR<cmGlobalXCodeGenerator> gg(
new cmGlobalXCodeGenerator(cm, parser.Version));
new cmGlobalXCodeGenerator(cm, version_string, version_number));
if (gg->XcodeVersion == 20) {
cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
"using Xcode 15 generator\n");

View File

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