diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-06-06 05:01:16 (GMT) |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-07-18 03:44:58 (GMT) |
commit | be0d4042082db4dcd263dd181570b6f406202ed9 (patch) | |
tree | b9ae5aa4768509bc3173f2088781f5e3c046ab51 /Source | |
parent | 79bcf4e1655ffa38e8f4740b19ec3a14ac567eec (diff) | |
download | CMake-be0d4042082db4dcd263dd181570b6f406202ed9.zip CMake-be0d4042082db4dcd263dd181570b6f406202ed9.tar.gz CMake-be0d4042082db4dcd263dd181570b6f406202ed9.tar.bz2 |
Support per-language library link flags
This changes the behaviour of the generators to use a per-language
library search path flag. This is needed for multi-language projects
with different compilers (e.g. cl + gfortran). Since the adjusted
variable has been part of the user settings, we control this based on a
policy.
Fixes: #19307
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fe5c8af..3abf2dd 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1444,10 +1444,23 @@ void cmLocalGenerator::OutputLinkLibraries( std::string linkLanguage = cli.GetLinkLanguage(); - const std::string& libPathFlag = - this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG"); - const std::string& libPathTerminator = - this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR"); + std::string libPathFlag; + if (const char* value = this->Makefile->GetDefinition( + "CMAKE_" + cli.GetLinkLanguage() + "_LIBRARY_PATH_FLAG")) { + libPathFlag = value; + } else { + libPathFlag = + this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG"); + } + + std::string libPathTerminator; + if (const char* value = this->Makefile->GetDefinition( + "CMAKE_" + cli.GetLinkLanguage() + "_LIBRARY_PATH_TERMINATOR")) { + libPathTerminator = value; + } else { + libPathTerminator = + this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_TERMINATOR"); + } // Add standard libraries for this language. std::string standardLibsVar = "CMAKE_"; |