Przeglądaj źródła

ENH: Added XCODE_ATTRIBUTE_<an-attribute> property to allow direct setting of Xcode target attributes in generated projects. For example, one may set the prefix header property and the corresponding precompiled option to do precompiled headers.

Brad King 18 lat temu
rodzic
commit
f2ac53bb10
2 zmienionych plików z 21 dodań i 0 usunięć
  1. 15 0
      Source/cmGlobalXCodeGenerator.cxx
  2. 6 0
      Source/cmTarget.cxx

+ 15 - 0
Source/cmGlobalXCodeGenerator.cxx

@@ -1576,6 +1576,21 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     {
     {
     debugStr = "NO";
     debugStr = "NO";
     }    
     }    
+
+  // Convert "XCODE_ATTRIBUTE_*" properties directly.
+  {
+  cmPropertyMap const& props = target.GetProperties();
+  for(cmPropertyMap::const_iterator i = props.begin();
+      i != props.end(); ++i)
+    {
+    if(i->first.find("XCODE_ATTRIBUTE_") == 0)
+      {
+      buildSettings->AddAttribute(i->first.substr(16).c_str(),
+                                  this->CreateString(i->second.GetValue()));
+      }
+    }
+  }
+
   buildSettings->AddAttribute("GCC_GENERATE_DEBUGGING_SYMBOLS",
   buildSettings->AddAttribute("GCC_GENERATE_DEBUGGING_SYMBOLS",
                               this->CreateString(debugStr));
                               this->CreateString(debugStr));
   buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL", 
   buildSettings->AddAttribute("GCC_OPTIMIZATION_LEVEL", 

+ 6 - 0
Source/cmTarget.cxx

@@ -276,6 +276,12 @@ void cmTarget::DefineProperties(cmake *cm)
      "exported symbols and then used for linking.  "
      "exported symbols and then used for linking.  "
      "All Windows-based systems including Cygwin are DLL platforms.");
      "All Windows-based systems including Cygwin are DLL platforms.");
 
 
+  cm->DefineProperty
+    ("XCODE_ATTRIBUTE_<an-attribute>", cmProperty::TARGET,
+     "Set Xcode target attributes directly.",
+     "Tell the Xcode generator to set '<an-attribute>' to a given value "
+     "in the generated Xcode project.  Ignored on other generators.");
+
   cm->DefineProperty
   cm->DefineProperty
     ("GENERATOR_FILE_NAME", cmProperty::TARGET,
     ("GENERATOR_FILE_NAME", cmProperty::TARGET,
      "Generator's file for this target.",
      "Generator's file for this target.",