summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-25 15:59:26 (GMT)
committerBrad King <brad.king@kitware.com>2023-05-25 17:42:58 (GMT)
commit023de565d33cdb095c0d5665e408493087e4d458 (patch)
tree8f52e06801201ec59cb11dab088dbd9a289f1be2 /Modules
parentcf7b7600c669ea162e0c3960c3e4e3a5d04f3274 (diff)
downloadCMake-023de565d33cdb095c0d5665e408493087e4d458.zip
CMake-023de565d33cdb095c0d5665e408493087e4d458.tar.gz
CMake-023de565d33cdb095c0d5665e408493087e4d458.tar.bz2
Optionally exclude implicit link directories via environment
A misconfigured compiler may pass extraneous implicit link directories to its linker. If they are in `CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES`, CMake may generate extra `-L` flags on mixed-language link lines that break linking. Add an environment variable that users can set to work around such misconfiguration of their compilers.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 3fd54cc..d665cd1 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -181,6 +181,10 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
endif()
endif()
+ if(DEFINED ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE})
+ list(REMOVE_ITEM implicit_dirs $ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE})
+ endif()
+
set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE)