From 20344de5f76fa6048e3ac0d509e9781954ae2588 Mon Sep 17 00:00:00 2001
From: Cody Krieger <cody@evaautomation.com>
Date: Tue, 25 Aug 2015 08:40:27 -0700
Subject: [PATCH v2] Add support for Xcode ORGANIZATIONNAME project setting via
 CMAKE_XCODE_ORGANIZATIONNAME.

I chose CMAKE_XCODE as the prefix rather than CMAKE_XCODE_ATTRIBUTE to
avoid having ORGANIZATIONNAME added to the buildSettings group of every
target. (ORGANIZATIONNAME is a project-level attribute, and isn't
evaluated at the target level.)
---
 Help/manual/cmake-variables.7.rst              | 1 +
 Help/variable/CMAKE_XCODE_ORGANIZATIONNAME.rst | 6 ++++++
 Source/cmGlobalXCodeGenerator.cxx              | 6 ++++++
 3 files changed, 13 insertions(+)
 create mode 100644 Help/variable/CMAKE_XCODE_ORGANIZATIONNAME.rst

diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index e0dbdeb..8578ed3 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -82,6 +82,7 @@ Variables that Provide Information
    /variable/CMAKE_VS_NsightTegra_VERSION
    /variable/CMAKE_VS_PLATFORM_NAME
    /variable/CMAKE_VS_PLATFORM_TOOLSET
+   /variable/CMAKE_XCODE_ORGANIZATIONNAME
    /variable/CMAKE_XCODE_PLATFORM_TOOLSET
    /variable/PROJECT_BINARY_DIR
    /variable/PROJECT-NAME_BINARY_DIR
diff --git a/Help/variable/CMAKE_XCODE_ORGANIZATIONNAME.rst b/Help/variable/CMAKE_XCODE_ORGANIZATIONNAME.rst
new file mode 100644
index 0000000..5f6a2d6
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_ORGANIZATIONNAME.rst
@@ -0,0 +1,6 @@
+CMAKE_XCODE_ORGANIZATIONNAME
+----------------------------
+
+Tell the :generator:`Xcode` generator to set the organization name to a given
+value in the generated Xcode project (used in boilerplate text, such as
+copyright strings, in new source file templates).  Ignored on other generators.
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index eb547bd..7641023 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3363,6 +3363,12 @@ bool cmGlobalXCodeGenerator
     group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
     group->AddAttribute("BuildIndependentTargetsInParallel",
                         this->CreateString("YES"));
+
+    const char* orgName =
+      this->CurrentMakefile->GetDefinition("CMAKE_XCODE_ORGANIZATIONNAME");
+    if (orgName)
+      group->AddAttribute("ORGANIZATIONNAME", this->CreateString(orgName));
+
     this->RootObject->AddAttribute("attributes", group);
     if (this->XcodeVersion >= 32)
       this->RootObject->AddAttribute("compatibilityVersion",
-- 
2.3.8 (Apple Git-58)

