[Cmake-commits] [cmake-commits] king committed cmDocumentVariables.cxx 1.42 1.43 cmGlobalXCodeGenerator.cxx 1.230 1.231 cmGlobalXCodeGenerator.h 1.63 1.64

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Sep 23 08:48:42 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv28308/Source

Modified Files:
	cmDocumentVariables.cxx cmGlobalXCodeGenerator.cxx 
	cmGlobalXCodeGenerator.h 
Log Message:
Teach Xcode generator to set XCODE_VERSION

We set the variable 'XCODE_VERSION' in the CMake language to the Xcode
version string (e.g. "3.1.2").  Platform config files may use it later.


Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.230
retrieving revision 1.231
diff -C 2 -d -r1.230 -r1.231
*** cmGlobalXCodeGenerator.cxx	22 Sep 2009 20:18:30 -0000	1.230
--- cmGlobalXCodeGenerator.cxx	23 Sep 2009 12:48:37 -0000	1.231
***************
*** 36,39 ****
--- 36,40 ----
  {
  public:
+   cmXcodeVersionParser(): Version("1.5") {}
    void StartElement(const char* , const char** )
      {
***************
*** 50,54 ****
          if(this->Key == "CFBundleShortVersionString")
            {
!           this->Version = (int)(10.0 * atof(this->Data.c_str()));
            }
          }
--- 51,55 ----
          if(this->Key == "CFBundleShortVersionString")
            {
!           this->Version = this->Data;
            }
          }
***************
*** 58,62 ****
        this->Data.append(data, length);
      }
!   int Version;
    std::string Key;
    std::string Data;
--- 59,63 ----
        this->Data.append(data, length);
      }
!   std::string Version;
    std::string Key;
    std::string Data;
***************
*** 116,121 ****
  
  //----------------------------------------------------------------------------
! cmGlobalXCodeGenerator::cmGlobalXCodeGenerator()
  {
    this->FindMakeProgramFile = "CMakeFindXCode.cmake";
    this->RootObject = 0;
--- 117,129 ----
  
  //----------------------------------------------------------------------------
! cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
  {
+   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->FindMakeProgramFile = "CMakeFindXCode.cmake";
    this->RootObject = 0;
***************
*** 125,129 ****
    this->CurrentMakefile = 0;
    this->CurrentLocalGenerator = 0;
-   this->XcodeVersion = 15;
  }
  
--- 133,136 ----
***************
*** 135,145 ****
    parser.ParseFile
      ("/Developer/Applications/Xcode.app/Contents/version.plist");
!   cmsys::auto_ptr<cmGlobalXCodeGenerator> gg(new cmGlobalXCodeGenerator);
!   if (parser.Version == 20)
      {
      cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
                             "using Xcode 15 generator\n");
      }
-   gg->SetVersion(parser.Version);
    return gg.release();
  #else
--- 142,153 ----
    parser.ParseFile
      ("/Developer/Applications/Xcode.app/Contents/version.plist");
!   cmsys::auto_ptr<cmGlobalXCodeGenerator>
!     gg(new cmGlobalXCodeGenerator(parser.Version));
!   if (gg->XcodeVersion == 20)
      {
      cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
                             "using Xcode 15 generator\n");
+     gg->XcodeVersion = 15;
      }
    return gg.release();
  #else
***************
*** 156,159 ****
--- 164,168 ----
  { 
    mf->AddDefinition("XCODE","1");
+   mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str());
    if(this->XcodeVersion == 15)
      {

Index: cmGlobalXCodeGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -C 2 -d -r1.63 -r1.64
*** cmGlobalXCodeGenerator.h	22 Sep 2009 20:18:31 -0000	1.63
--- cmGlobalXCodeGenerator.h	23 Sep 2009 12:48:38 -0000	1.64
***************
*** 34,41 ****
  {
  public:
!   cmGlobalXCodeGenerator();
    static cmGlobalGenerator* New();
  
-   void SetVersion(int v) { this->XcodeVersion = v;}
    ///! Get the name for the generator.
    virtual const char* GetName() const {
--- 34,40 ----
  {
  public:
!   cmGlobalXCodeGenerator(std::string const& version);
    static cmGlobalGenerator* New();
  
    ///! Get the name for the generator.
    virtual const char* GetName() const {
***************
*** 194,198 ****
    virtual const char* GetPackageTargetName()      { return "package"; }
  
!   int XcodeVersion;
    std::vector<cmXCodeObject*> XCodeObjects;
    cmXCodeObject* RootObject;
--- 193,198 ----
    virtual const char* GetPackageTargetName()      { return "package"; }
  
!   unsigned int XcodeVersion;
!   std::string VersionString;
    std::vector<cmXCodeObject*> XCodeObjects;
    cmXCodeObject* RootObject;

Index: cmDocumentVariables.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDocumentVariables.cxx,v
retrieving revision 1.42
retrieving revision 1.43
diff -C 2 -d -r1.42 -r1.43
*** cmDocumentVariables.cxx	3 Sep 2009 21:01:05 -0000	1.42
--- cmDocumentVariables.cxx	23 Sep 2009 12:48:35 -0000	1.43
***************
*** 786,789 ****
--- 786,796 ----
  
    cm->DefineProperty
+     ("XCODE_VERSION", cmProperty::VARIABLE,
+      "Version of Xcode (Xcode generator only).",
+      "Under the Xcode generator, this is the version of Xcode as specified in "
+      "\"Xcode.app/Contents/version.plist\" (such as \"3.1.2\").",false,
+      "Variables That Describe the System");
+ 
+   cm->DefineProperty
      ("CMAKE_HOST_APPLE", cmProperty::VARIABLE,
       "True for Apple OSXoperating systems.",



More information about the Cmake-commits mailing list