[cmake-developers] [PATCH] Proposed fix for bug 15183

Marko Kylmämaa mkylmamaa at reforgedstudios.com
Wed Jan 13 06:13:40 EST 2016


Hello,

I would like to propose the following fix for bug 15183 (
https://cmake.org/Bug/view.php?id=15183)

For some reason the XcodeGenerator seemed to be setting the INSTALL_PATH
variable regardless of if it was initialized or not (which is done only for
shared libraries). This seems almost certainly undesirable so I've moved
the code inside the shared library check.

The fix is based on v3.4.1 tag.

---
 Source/cmGlobalXCodeGenerator.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Source/cmGlobalXCodeGenerator.cxx
b/Source/cmGlobalXCodeGenerator.cxx
index 33babec..089bb47 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2329,10 +2329,10 @@ void
cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
                                 this->CreateString(format));
     }

-  // Create the INSTALL_PATH attribute.
-  std::string install_name_dir;
   if(target.GetType() == cmTarget::SHARED_LIBRARY)
     {
+ // Create the INSTALL_PATH attribute.
+ std::string install_name_dir;
     // Get the install_name directory for the build tree.
     install_name_dir = gtgt->GetInstallNameDirForBuildTree(configName);
     // Xcode doesn't create the correct install_name in some cases.
@@ -2356,9 +2356,9 @@ void
cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
       extraLinkOptions += " -install_name ";
       extraLinkOptions += XCodeEscapePath(install_name.c_str());
       }
+ buildSettings->AddAttribute("INSTALL_PATH",
+ this->CreateString(install_name_dir.c_str()));
     }
-  buildSettings->AddAttribute("INSTALL_PATH",
-
 this->CreateString(install_name_dir.c_str()));

   // Create the LD_RUNPATH_SEARCH_PATHS
   cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName);
-- 
2.5.4 (Apple Git-61)



*Marko KylmamaaCTO*
*Reforged Studios* <http://www.reforgedstudios.com>
*Cell:* +1-949-872-9650
*Skype:* mkylmamaa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160113/96800396/attachment.html>


More information about the cmake-developers mailing list