GHS: Implement link flags and dirs for non-target groups (#16029)

This commit is contained in:
Geoff Viola 2016-03-26 21:28:31 -06:00 committed by Brad King
parent 230d50ed1a
commit 36ad8dd440
3 changed files with 36 additions and 3 deletions

View File

@ -4,3 +4,5 @@ endif()
set(__COMPILER_GHS 1) set(__COMPILER_GHS 1)
set(CMAKE_EXECUTABLE_SUFFIX ".as") set(CMAKE_EXECUTABLE_SUFFIX ".as")
set(CMAKE_LIBRARY_PATH_TERMINATOR "\n")
set(CMAKE_LIBRARY_PATH_FLAG " -L")

View File

@ -149,7 +149,7 @@ void cmGhsMultiTargetGenerator::Generate()
this->WriteIncludes(config, language); this->WriteIncludes(config, language);
if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE)
{ {
this->WriteTargetLinkLibraries(); this->WriteTargetLinkLibraries(config, language);
} }
this->WriteCustomCommands(); this->WriteCustomCommands();
@ -365,7 +365,8 @@ void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config,
} }
} }
void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
std::string const& config, std::string const& language)
{ {
// library directories // library directories
cmTargetDependSet tds = cmTargetDependSet tds =
@ -393,6 +394,35 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
*this->GetFolderBuildStreams() << " -l\"" << libName << "\"" *this->GetFolderBuildStreams() << " -l\"" << libName << "\""
<< std::endl; << std::endl;
} }
if (!this->TargetGroup)
{
std::string linkLibraries;
std::string flags;
std::string linkFlags;
std::string frameworkPath;
std::string linkPath;
std::string createRule =
this->GeneratorTarget->GetCreateRuleVariable(language, config);
bool useWatcomQuote =
this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
this->LocalGenerator->GetTargetFlags(
linkLibraries, flags, linkFlags,
frameworkPath, linkPath,
this->GeneratorTarget, useWatcomQuote);
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
if (!linkPath.empty())
{
linkPath = " " + linkPath.substr(0U, linkPath.size() - 1U);
*this->GetFolderBuildStreams() << linkPath;
}
if (!linkFlags.empty())
{
*this->GetFolderBuildStreams() << " " << linkFlags << std::endl;
}
}
} }
void cmGhsMultiTargetGenerator::WriteCustomCommands() void cmGhsMultiTargetGenerator::WriteCustomCommands()

View File

@ -81,7 +81,8 @@ private:
std::string const &config); std::string const &config);
void WriteIncludes(const std::string &config, const std::string &language); void WriteIncludes(const std::string &config, const std::string &language);
void WriteTargetLinkLibraries(); void WriteTargetLinkLibraries(std::string const& config,
std::string const& language);
void WriteCustomCommands(); void WriteCustomCommands();
void void
WriteCustomCommandsHelper(std::vector<cmCustomCommand> const &commandsSet, WriteCustomCommandsHelper(std::vector<cmCustomCommand> const &commandsSet,