summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeParseLibraryArchitecture.cmake
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2021-04-05 19:28:54 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2021-04-05 21:41:10 (GMT)
commit764606e25616e9f47eceb3227a3b38fcef544820 (patch)
tree7a37b1499cf84a1da7fbae42f84c460f2c645eaf /Modules/CMakeParseLibraryArchitecture.cmake
parent5d44d73bbeaf04412aa744354cca9de8376cdfed (diff)
downloadCMake-764606e25616e9f47eceb3227a3b38fcef544820.zip
CMake-764606e25616e9f47eceb3227a3b38fcef544820.tar.gz
CMake-764606e25616e9f47eceb3227a3b38fcef544820.tar.bz2
CMakeDetermineCompilerABI: Extract lib arch from implicit object file paths
The NVHPC compiler does not have any implicit link directories that can be used to detect `CMAKE_LIBRARY_ARCHITECTURE`, but it does have implicit object files. Extract implicit object file paths from link lines and check them for the `CMAKE_LIBRARY_ARCHITECTURE` pattern. Issue: #22024
Diffstat (limited to 'Modules/CMakeParseLibraryArchitecture.cmake')
-rw-r--r--Modules/CMakeParseLibraryArchitecture.cmake13
1 files changed, 11 insertions, 2 deletions
diff --git a/Modules/CMakeParseLibraryArchitecture.cmake b/Modules/CMakeParseLibraryArchitecture.cmake
index f2bb07a..6fb9c6b 100644
--- a/Modules/CMakeParseLibraryArchitecture.cmake
+++ b/Modules/CMakeParseLibraryArchitecture.cmake
@@ -9,17 +9,26 @@ cmake_policy(SET CMP0054 NEW)
# This is used internally by CMake and should not be included by user
# code.
-function(cmake_parse_library_architecture implicit_dirs output_var)
+function(cmake_parse_library_architecture lang implicit_dirs implicit_objs output_var)
unset(library_arch)
# Detect library architecture directory name.
if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
- foreach(dir ${implicit_dirs})
+ foreach(dir IN LISTS implicit_dirs)
if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
get_filename_component(arch "${dir}" NAME)
set(library_arch "${arch}")
break()
endif()
endforeach()
+
+ foreach(obj IN LISTS implicit_objs)
+ get_filename_component(dir "${obj}" DIRECTORY)
+ if("${dir}" MATCHES "(/usr)+/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
+ get_filename_component(arch "${dir}" NAME)
+ set(library_arch "${arch}")
+ break()
+ endif()
+ endforeach()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL QCC)