diff options
author | Geoff Viola <geoffrey.viola@asirobots.com> | 2016-03-27 03:28:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-03-28 15:46:46 (GMT) |
commit | 36ad8dd440069b126ca28dccf57e8c65188c693b (patch) | |
tree | 155c74284c62f6ed1d4c234e351016bfdd742be7 | |
parent | 230d50ed1a1bbeac3b840ecc2d45c1b8710c8be4 (diff) | |
download | CMake-36ad8dd440069b126ca28dccf57e8c65188c693b.zip CMake-36ad8dd440069b126ca28dccf57e8c65188c693b.tar.gz CMake-36ad8dd440069b126ca28dccf57e8c65188c693b.tar.bz2 |
GHS: Implement link flags and dirs for non-target groups (#16029)
-rw-r--r-- | Modules/Compiler/GHS.cmake | 2 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 34 | ||||
-rw-r--r-- | 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<cmCustomCommand> const &commandsSet, |