Merge topic 'per-lang-link-library-flag'

79b2824251 Add per-lang variants of CMAKE_LINK_LIBRARY_{FILE_FLAG,SUFFIX}

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3747
This commit is contained in:
Brad King 2019-08-29 13:40:40 +00:00 committed by Kitware Robot
commit 3ec986ce8e
5 changed files with 36 additions and 8 deletions

View File

@ -62,6 +62,7 @@ Variables that Provide Information
/variable/CMAKE_JOB_POOLS
/variable/CMAKE_LANG_COMPILER_AR
/variable/CMAKE_LANG_COMPILER_RANLIB
/variable/CMAKE_LANG_LINK_LIBRARY_SUFFIX
/variable/CMAKE_LINK_LIBRARY_SUFFIX
/variable/CMAKE_LINK_SEARCH_END_STATIC
/variable/CMAKE_LINK_SEARCH_START_STATIC
@ -385,6 +386,7 @@ Variables that Control the Build
/variable/CMAKE_LANG_CPPCHECK
/variable/CMAKE_LANG_CPPLINT
/variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE
/variable/CMAKE_LANG_LINK_LIBRARY_FILE_FLAG
/variable/CMAKE_LANG_LINK_LIBRARY_FLAG
/variable/CMAKE_LANG_VISIBILITY_PRESET
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY

View File

@ -1,7 +1,9 @@
per-lang-link-library-flag
--------------------------
* The new :variable:`CMAKE_<LANG>_LINK_LIBRARY_FLAG` flag allows you to now
control the flag used to specify linking to a library on a per-language basis.
This is useful for mixed-language projects where the different drivers may use
different flags.
* New variables :variable:`CMAKE_<LANG>_LINK_LIBRARY_FLAG`,
:variable:`CMAKE_<LANG>_LINK_LIBRARY_FILE_FLAG`, and
:variable:`CMAKE_<LANG>_LINK_LIBRARY_SUFFIX` allow control of the
flag used to specify linking to a library on a per-language basis.
This is useful for mixed-language projects where the different
drivers may use different flags.

View File

@ -0,0 +1,8 @@
CMAKE_<LANG>_LINK_LIBRARY_FILE_FLAG
-----------------------------------
Language-specific flag to be used to link a library specified by
a path to its file.
The flag will be used before a library file path is given to the
linker. This is needed only on very few platforms.

View File

@ -0,0 +1,6 @@
CMAKE_<LANG>_LINK_LIBRARY_SUFFIX
--------------------------------
Language-specific suffix for libraries that you link to.
The suffix to use for the end of a library filename, ``.lib`` on Windows.

View File

@ -292,10 +292,20 @@ cmComputeLinkInformation::cmComputeLinkInformation(
this->LibLinkFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
}
this->LibLinkFileFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FILE_FLAG");
this->LibLinkSuffix =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_SUFFIX");
if (const char* flag = this->Makefile->GetDefinition(
"CMAKE_" + this->LinkLanguage + "_LINK_LIBRARY_FILE_FLAG")) {
this->LibLinkFileFlag = flag;
} else {
this->LibLinkFileFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FILE_FLAG");
}
if (const char* suffix = this->Makefile->GetDefinition(
"CMAKE_" + this->LinkLanguage + "_LINK_LIBRARY_SUFFIX")) {
this->LibLinkSuffix = suffix;
} else {
this->LibLinkSuffix =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_SUFFIX");
}
// Get options needed to specify RPATHs.
this->RuntimeUseChrpath = false;