diff options
author | Brad King <brad.king@kitware.com> | 2016-03-29 13:24:36 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-03-29 13:24:36 (GMT) |
commit | 2ab344a1dcfcc91cf7337cd700af827a60fec811 (patch) | |
tree | 1d825954139b07bf937fb3907148592babc48b21 | |
parent | 439237442237a74d2923a671fa6f71bb1678e3eb (diff) | |
parent | 36ad8dd440069b126ca28dccf57e8c65188c693b (diff) | |
download | CMake-2ab344a1dcfcc91cf7337cd700af827a60fec811.zip CMake-2ab344a1dcfcc91cf7337cd700af827a60fec811.tar.gz CMake-2ab344a1dcfcc91cf7337cd700af827a60fec811.tar.bz2 |
Merge topic 'ghs-link-flags'
36ad8dd4 GHS: Implement link flags and dirs for non-target groups (#16029)
230d50ed GHS: Factor out compiler information shared among languages
-rw-r--r-- | Modules/Compiler/GHS-C.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/GHS-CXX.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/GHS.cmake | 8 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 34 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.h | 3 |
5 files changed, 46 insertions, 7 deletions
diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake index a58d9b0..50532ce 100644 --- a/Modules/Compiler/GHS-C.cmake +++ b/Modules/Compiler/GHS-C.cmake @@ -1,3 +1,5 @@ +include(Compiler/GHS) + set(CMAKE_C_VERBOSE_FLAG "-v") set(CMAKE_C_FLAGS_INIT "") @@ -12,8 +14,6 @@ set(CMAKE_C_GHS_KERNEL_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT}") set(CMAKE_C_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT "-ldebug ${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}") -set(CMAKE_EXECUTABLE_SUFFIX ".as") - if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) set (CMAKE_C_GHS_KERNEL_FLAGS_DEBUG "${CMAKE_C_GHS_KERNEL_FLAGS_DEBUG_INIT}" CACHE STRING "Kernel flags used by the compiler during debug builds.") diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake index 9e202d3..2cffa0d 100644 --- a/Modules/Compiler/GHS-CXX.cmake +++ b/Modules/Compiler/GHS-CXX.cmake @@ -1,3 +1,5 @@ +include(Compiler/GHS) + set(CMAKE_CXX_VERBOSE_FLAG "-v") set(CMAKE_CXX_FLAGS_INIT "") @@ -15,8 +17,6 @@ set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELEASE_INIT set(CMAKE_CXX_GHS_KERNEL_FLAGS_RELWITHDEBINFO_INIT "-ldebug ${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}") -set(CMAKE_EXECUTABLE_SUFFIX ".as") - if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) set (CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG "${CMAKE_CXX_GHS_KERNEL_FLAGS_DEBUG_INIT}" diff --git a/Modules/Compiler/GHS.cmake b/Modules/Compiler/GHS.cmake new file mode 100644 index 0000000..e6a867d --- /dev/null +++ b/Modules/Compiler/GHS.cmake @@ -0,0 +1,8 @@ +if(__COMPILER_GHS) + return() +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, |