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
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to