[cmake-developers] [CMake 0014161]: Xcode generator ignores CMAKE_(MODULE|SHARED)_LINKER_FLAGS_<CONFIG>

Mantis Bug Tracker mantis at public.kitware.com
Wed May 22 08:44:38 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14161 
====================================================================== 
Reported By:                Matthew Bentham
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14161
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-05-22 08:44 EDT
Last Modified:              2013-05-22 08:44 EDT
====================================================================== 
Summary:                    Xcode generator ignores
CMAKE_(MODULE|SHARED)_LINKER_FLAGS_<CONFIG>
Description: 
When generating using Xcode, the following variables have no effect:

CMAKE_MODULE_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_RELEASE

The _<CONFIG> variants of CMAKE_EXE_LINKER_FLAGS work correctly, as do the base
variables CMAKE_MODULE_LINKER_FLAGS and CMAKE_SHARED_LINKER_FLAGS.

Additional Information: 
Suggested patch:

Index: Source/cmGlobalXCodeGenerator.cxx
===================================================================
--- Source/cmGlobalXCodeGenerator.cxx	(revision 47381)
+++ Source/cmGlobalXCodeGenerator.cxx	(working copy)
@@ -1714,30 +1714,26 @@
   buildSettings->AddAttribute
     ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
 
+  std::string extraLinkOptionsVar;
   std::string extraLinkOptions;
   if(target.GetType() == cmTarget::EXECUTABLE)
     {
-    extraLinkOptions =
-      this->CurrentMakefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS");
-    std::string var = "CMAKE_EXE_LINKER_FLAGS_";
-    var += cmSystemTools::UpperCase(configName);
-    std::string val =
-      this->CurrentMakefile->GetSafeDefinition(var.c_str());
-    if(val.size())
-      {
-      extraLinkOptions += " ";
-      extraLinkOptions += val;
-      }
+    extraLinkOptionsVar = "CMAKE_EXE_LINKER_FLAGS";
     }
-  if(target.GetType() == cmTarget::SHARED_LIBRARY)
+  else if(target.GetType() == cmTarget::SHARED_LIBRARY)
     {
-    extraLinkOptions = this->CurrentMakefile->
-      GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS");
+    extraLinkOptionsVar = "CMAKE_SHARED_LINKER_FLAGS";
     }
-  if(target.GetType() == cmTarget::MODULE_LIBRARY)
+  else if(target.GetType() == cmTarget::MODULE_LIBRARY)
     {
-    extraLinkOptions = this->CurrentMakefile->
-      GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS");
+    extraLinkOptionsVar = "CMAKE_MODULE_LINKER_FLAGS";
+    } 
+
+  if (extraLinkOptionsVar.size())
+    {
+    this->CurrentLocalGenerator->AddConfigVariableFlags(extraLinkOptions,
+                                                       
extraLinkOptionsVar.c_str(),
+                                                        configName);
     }
 
   const char* linkFlagsProp = "LINK_FLAGS";
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-05-22 08:44 Matthew BenthamNew Issue                                    
======================================================================




More information about the cmake-developers mailing list