From 36ad8dd440069b126ca28dccf57e8c65188c693b Mon Sep 17 00:00:00 2001 From: Geoff Viola Date: Sat, 26 Mar 2016 21:28:31 -0600 Subject: GHS: Implement link flags and dirs for non-target groups (#16029) --- Modules/Compiler/GHS.cmake | 2 ++ Source/cmGhsMultiTargetGenerator.cxx | 34 ++++++++++++++++++++++++++++++++-- Source/cmGhsMultiTargetGenerator.h | 3 ++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Modules/Compiler/GHS.cmake b/Modules/Compiler/GHS.cmake index cfc29c2..e6a867d 100644 --- a/Modules/Compiler/GHS.cmake +++ b/Modules/Compiler/GHS.cmake @@ -4,3 +4,5 @@ endif() set(__COMPILER_GHS 1) set(CMAKE_EXECUTABLE_SUFFIX ".as") +set(CMAKE_LIBRARY_PATH_TERMINATOR "\n") +set(CMAKE_LIBRARY_PATH_FLAG " -L") diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index c5813ba..1f17f8f 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -149,7 +149,7 @@ void cmGhsMultiTargetGenerator::Generate() this->WriteIncludes(config, language); if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { - this->WriteTargetLinkLibraries(); + this->WriteTargetLinkLibraries(config, language); } 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 cmTargetDependSet tds = @@ -393,6 +394,35 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() *this->GetFolderBuildStreams() << " -l\"" << libName << "\"" << 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() diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 327fdef..e85e412 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -81,7 +81,8 @@ private: std::string const &config); 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 WriteCustomCommandsHelper(std::vector const &commandsSet, -- cgit v0.12