diff --git a/Modules/Compiler/GHS.cmake b/Modules/Compiler/GHS.cmake index cfc29c2a8..e6a867d04 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 c5813ba2f..1f17f8f89 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 327fdefc9..e85e41272 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,