Merge topic 'refactor-cmLocalGenerator-flags'
b0d3e693
cmLocalGenerator: Pass configuration to GetTargetFlags
This commit is contained in:
commit
c21397b2df
|
@ -371,7 +371,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
|
||||||
bool useWatcomQuote =
|
bool useWatcomQuote =
|
||||||
this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
|
this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
|
||||||
this->LocalGenerator->GetTargetFlags(
|
this->LocalGenerator->GetTargetFlags(
|
||||||
linkLibraries, flags, linkFlags, frameworkPath, linkPath,
|
config, linkLibraries, flags, linkFlags, frameworkPath, linkPath,
|
||||||
this->GeneratorTarget, useWatcomQuote);
|
this->GeneratorTarget, useWatcomQuote);
|
||||||
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
|
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
|
||||||
|
|
||||||
|
|
|
@ -1152,13 +1152,11 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalGenerator::GetTargetFlags(
|
void cmLocalGenerator::GetTargetFlags(
|
||||||
std::string& linkLibs, std::string& flags, std::string& linkFlags,
|
const std::string& config, std::string& linkLibs, std::string& flags,
|
||||||
std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target,
|
std::string& linkFlags, std::string& frameworkPath, std::string& linkPath,
|
||||||
bool useWatcomQuote)
|
cmGeneratorTarget* target, bool useWatcomQuote)
|
||||||
{
|
{
|
||||||
std::string buildType =
|
const std::string buildType = cmSystemTools::UpperCase(config);
|
||||||
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
|
||||||
buildType = cmSystemTools::UpperCase(buildType);
|
|
||||||
const char* libraryLinkVariable =
|
const char* libraryLinkVariable =
|
||||||
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
|
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
|
||||||
|
|
||||||
|
|
|
@ -308,10 +308,10 @@ public:
|
||||||
|
|
||||||
/** Fill out these strings for the given target. Libraries to link,
|
/** Fill out these strings for the given target. Libraries to link,
|
||||||
* flags, and linkflags. */
|
* flags, and linkflags. */
|
||||||
void GetTargetFlags(std::string& linkLibs, std::string& flags,
|
void GetTargetFlags(const std::string& config, std::string& linkLibs,
|
||||||
std::string& linkFlags, std::string& frameworkPath,
|
std::string& flags, std::string& linkFlags,
|
||||||
std::string& linkPath, cmGeneratorTarget* target,
|
std::string& frameworkPath, std::string& linkPath,
|
||||||
bool useWatcomQuote);
|
cmGeneratorTarget* target, bool useWatcomQuote);
|
||||||
|
|
||||||
virtual void ComputeObjectFilenames(
|
virtual void ComputeObjectFilenames(
|
||||||
std::map<cmSourceFile const*, std::string>& mapping,
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
|
|
@ -434,9 +434,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
vars["TARGET_FILE"] =
|
vars["TARGET_FILE"] =
|
||||||
localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
|
localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
|
||||||
|
|
||||||
localGen.GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"],
|
localGen.GetTargetFlags(this->GetConfigName(), vars["LINK_LIBRARIES"],
|
||||||
vars["LINK_FLAGS"], frameworkPath, linkPath,
|
vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath,
|
||||||
&genTarget, useWatcomQuote);
|
linkPath, &genTarget, useWatcomQuote);
|
||||||
if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
|
if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
|
||||||
gt.GetType() == cmState::SHARED_LIBRARY) {
|
gt.GetType() == cmState::SHARED_LIBRARY) {
|
||||||
if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
|
if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
|
||||||
|
|
|
@ -481,6 +481,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
|
||||||
mf->AddLinkLibraryForTarget(targetName, *libIt, GENERAL_LibraryType);
|
mf->AddLinkLibraryForTarget(targetName, *libIt, GENERAL_LibraryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string buildType = mf->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||||
|
buildType = cmSystemTools::UpperCase(buildType);
|
||||||
|
|
||||||
std::string linkLibs;
|
std::string linkLibs;
|
||||||
std::string frameworkPath;
|
std::string frameworkPath;
|
||||||
std::string linkPath;
|
std::string linkPath;
|
||||||
|
@ -489,8 +492,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
|
||||||
gg->CreateGenerationObjects();
|
gg->CreateGenerationObjects();
|
||||||
cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
|
cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
|
||||||
cmLocalGenerator* lg = gtgt->GetLocalGenerator();
|
cmLocalGenerator* lg = gtgt->GetLocalGenerator();
|
||||||
lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
|
lg->GetTargetFlags(buildType, linkLibs, frameworkPath, linkPath, flags,
|
||||||
gtgt, false);
|
linkFlags, gtgt, false);
|
||||||
linkLibs = frameworkPath + linkPath + linkLibs;
|
linkLibs = frameworkPath + linkPath + linkLibs;
|
||||||
|
|
||||||
printf("%s\n", linkLibs.c_str());
|
printf("%s\n", linkLibs.c_str());
|
||||||
|
|
Loading…
Reference in New Issue