summaryrefslogtreecommitdiff
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-08-08 09:31:42 -0700
committerSaleem Abdulrasool <compnerd@compnerd.org>2019-08-09 08:16:29 -0700
commit689be6235e5be32e8ee8e37801dde1fb1c5add2a (patch)
treec4d901a70e328d716bb2fc99dfa8e09e40980f08 /Source/cmComputeLinkInformation.cxx
parent1996e0157826903f27f73825a01f83d53dc8fba4 (diff)
downloadcmake-689be6235e5be32e8ee8e37801dde1fb1c5add2a.tar.gz
Generator: support per-language link library flag
This enables the use of MSVC and Swift on Windows in a single project. MSVC uses no flag to indicate linked libraries while Swift uses `-l`. Add support for a language specific link library flag which takes precedence over the global `CMAKE_LINK_LIBRARY_FLAG` which preserves compatibility with earlier releases.
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 4aa18f26ef..0741f8be93 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -285,8 +285,13 @@ cmComputeLinkInformation::cmComputeLinkInformation(
}
// Get options needed to link libraries.
- this->LibLinkFlag =
- this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
+ if (const char* flag = this->Makefile->GetDefinition(
+ "CMAKE_" + this->LinkLanguage + "_LINK_LIBRARY_FLAG")) {
+ this->LibLinkFlag = flag;
+ } else {
+ this->LibLinkFlag =
+ this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
+ }
this->LibLinkFileFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FILE_FLAG");
this->LibLinkSuffix =