Browse Source

cmLocalGenerator: Pass configuration to GetTargetFlags

Move the configuration lookup to call sites.  This will allow
multi-configuration callers to use the method.
Tobias Hunger 9 years ago
parent
commit
b0d3e693f1

+ 1 - 1
Source/cmGhsMultiTargetGenerator.cxx

@@ -371,7 +371,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
     bool useWatcomQuote =
       this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
     this->LocalGenerator->GetTargetFlags(
-      linkLibraries, flags, linkFlags, frameworkPath, linkPath,
+      config, linkLibraries, flags, linkFlags, frameworkPath, linkPath,
       this->GeneratorTarget, useWatcomQuote);
     linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
 

+ 4 - 6
Source/cmLocalGenerator.cxx

@@ -1152,13 +1152,11 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
 }
 
 void cmLocalGenerator::GetTargetFlags(
-  std::string& linkLibs, std::string& flags, std::string& linkFlags,
-  std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target,
-  bool useWatcomQuote)
+  const std::string& config, std::string& linkLibs, std::string& flags,
+  std::string& linkFlags, std::string& frameworkPath, std::string& linkPath,
+  cmGeneratorTarget* target, bool useWatcomQuote)
 {
-  std::string buildType =
-    this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
-  buildType = cmSystemTools::UpperCase(buildType);
+  const std::string buildType = cmSystemTools::UpperCase(config);
   const char* libraryLinkVariable =
     "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
 

+ 4 - 4
Source/cmLocalGenerator.h

@@ -308,10 +308,10 @@ public:
 
   /** Fill out these strings for the given target.  Libraries to link,
    *  flags, and linkflags. */
-  void GetTargetFlags(std::string& linkLibs, std::string& flags,
-                      std::string& linkFlags, std::string& frameworkPath,
-                      std::string& linkPath, cmGeneratorTarget* target,
-                      bool useWatcomQuote);
+  void GetTargetFlags(const std::string& config, std::string& linkLibs,
+                      std::string& flags, std::string& linkFlags,
+                      std::string& frameworkPath, std::string& linkPath,
+                      cmGeneratorTarget* target, bool useWatcomQuote);
 
   virtual void ComputeObjectFilenames(
     std::map<cmSourceFile const*, std::string>& mapping,

+ 3 - 3
Source/cmNinjaNormalTargetGenerator.cxx

@@ -434,9 +434,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
   vars["TARGET_FILE"] =
     localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
 
-  localGen.GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"],
-                          vars["LINK_FLAGS"], frameworkPath, linkPath,
-                          &genTarget, useWatcomQuote);
+  localGen.GetTargetFlags(this->GetConfigName(), vars["LINK_LIBRARIES"],
+                          vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath,
+                          linkPath, &genTarget, useWatcomQuote);
   if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
       gt.GetType() == cmState::SHARED_LIBRARY) {
     if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {

+ 5 - 2
Source/cmake.cxx

@@ -482,6 +482,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
       mf->AddLinkLibraryForTarget(targetName, *libIt, GENERAL_LibraryType);
     }
 
+    std::string buildType = mf->GetSafeDefinition("CMAKE_BUILD_TYPE");
+    buildType = cmSystemTools::UpperCase(buildType);
+
     std::string linkLibs;
     std::string frameworkPath;
     std::string linkPath;
@@ -490,8 +493,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
     gg->CreateGenerationObjects();
     cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
     cmLocalGenerator* lg = gtgt->GetLocalGenerator();
-    lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
-                       gtgt, false);
+    lg->GetTargetFlags(buildType, linkLibs, frameworkPath, linkPath, flags,
+                       linkFlags, gtgt, false);
     linkLibs = frameworkPath + linkPath + linkLibs;
 
     printf("%s\n", linkLibs.c_str());