Browse Source

Merge topic 'xcode-debug-document-versioning'

67200c37b0 xcode: Add XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING property

Acked-by: Kitware Robot <[email protected]>
Merge-request: !3876
Brad King 6 years ago
parent
commit
0c5f78478e

+ 1 - 0
Help/manual/cmake-properties.7.rst

@@ -375,6 +375,7 @@ Properties on Targets
    /prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
    /prop_tgt/XCODE_SCHEME_ARGUMENTS
    /prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT
+   /prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
    /prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
    /prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
    /prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE

+ 1 - 0
Help/manual/cmake-variables.7.rst

@@ -234,6 +234,7 @@ Variables that Change Behavior
    /variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY
    /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
    /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+   /variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
    /variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
    /variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
    /variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE

+ 2 - 1
Help/prop_tgt/XCODE_GENERATE_SCHEME.rst

@@ -31,9 +31,10 @@ at target creation time.
 - :prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS`
 
 The following target properties will be applied on the
-"Info" and "Arguments" tab:
+"Info", "Arguments", and "Options" tab:
 
 - :prop_tgt:`XCODE_SCHEME_ARGUMENTS`
 - :prop_tgt:`XCODE_SCHEME_DEBUG_AS_ROOT`
+- :prop_tgt:`XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING`
 - :prop_tgt:`XCODE_SCHEME_ENVIRONMENT`
 - :prop_tgt:`XCODE_SCHEME_EXECUTABLE`

+ 13 - 0
Help/prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst

@@ -0,0 +1,13 @@
+XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
+--------------------------------------
+
+Whether to enable
+``Allow debugging when using document Versions Browser``
+in the Options section of the generated Xcode scheme.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING`
+if it is set when a target is created.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.

+ 7 - 0
Help/release/dev/xcode-debug-document-versioning.rst

@@ -0,0 +1,7 @@
+xcode-debug-document-versioning
+-------------------------------
+
+* The Xcode generator learnt to set the value of the
+  ``Allow debugging when using document Versions Browser`` schema
+  option with the :prop_tgt:`XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING`
+  target property.

+ 13 - 0
Help/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst

@@ -0,0 +1,13 @@
+CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
+--------------------------------------------
+
+Whether to enable
+``Allow debugging when using document Versions Browser``
+in the Options section of the generated Xcode scheme.
+
+This variable initializes the
+:prop_tgt:`XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING`
+property on all targets.
+
+Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
+documentation to see all Xcode schema related properties.

+ 1 - 0
Source/cmTarget.cxx

@@ -366,6 +366,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
       initProp("XCODE_GENERATE_SCHEME");
       initProp("XCODE_SCHEME_ADDRESS_SANITIZER");
       initProp("XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN");
+      initProp("XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING");
       initProp("XCODE_SCHEME_THREAD_SANITIZER");
       initProp("XCODE_SCHEME_THREAD_SANITIZER_STOP");
       initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER");

+ 21 - 2
Source/cmXCodeScheme.cxx

@@ -137,7 +137,9 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
   xout.Attribute("launchStyle", "0");
   xout.Attribute("useCustomWorkingDirectory", "NO");
   xout.Attribute("ignoresPersistentStateOnLaunch", "NO");
-  xout.Attribute("debugDocumentVersioning", "YES");
+  WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning",
+                                    "XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING",
+                                    true);
   xout.Attribute("debugServiceExtension", "internal");
   xout.Attribute("allowLocationSimulation", "YES");
 
@@ -311,6 +313,21 @@ bool cmXCodeScheme::WriteLaunchActionAttribute(cmXMLWriter& xout,
   return false;
 }
 
+bool cmXCodeScheme::WriteLaunchActionBooleanAttribute(
+  cmXMLWriter& xout, const std::string& attrName, const std::string& varName,
+  bool defaultValue)
+{
+  auto property = Target->GetTarget()->GetProperty(varName);
+  bool isOn = (property == nullptr && defaultValue) || cmIsOn(property);
+
+  if (isOn) {
+    xout.Attribute(attrName.c_str(), "YES");
+  } else {
+    xout.Attribute(attrName.c_str(), "NO");
+  }
+  return isOn;
+}
+
 bool cmXCodeScheme::WriteLaunchActionAdditionalOption(
   cmXMLWriter& xout, const std::string& key, const std::string& value,
   const std::string& varName)
@@ -339,7 +356,9 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
   xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES");
   xout.Attribute("savedToolIdentifier", "");
   xout.Attribute("useCustomWorkingDirectory", "NO");
-  xout.Attribute("debugDocumentVersioning", "YES");
+  WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning",
+                                    "XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING",
+                                    true);
   xout.EndElement();
 }
 

+ 5 - 0
Source/cmXCodeScheme.h

@@ -46,6 +46,11 @@ private:
                                   const std::string& attrName,
                                   const std::string& varName);
 
+  bool WriteLaunchActionBooleanAttribute(cmXMLWriter& xout,
+                                         const std::string& attrName,
+                                         const std::string& varName,
+                                         bool defaultValue);
+
   bool WriteLaunchActionAdditionalOption(cmXMLWriter& xout,
                                          const std::string& attrName,
                                          const std::string& value,