diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2021-02-03 22:31:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-04 20:17:49 (GMT) |
commit | 657fc3a9a719831f9943c552e86e58ae283dad43 (patch) | |
tree | 244511bcf923be35fe38c22aea3a19580dbf93e6 /Modules/CMakeDetermineCompilerABI.cmake | |
parent | c28dbd7e308968089bf97df71d4fd74c99e718f1 (diff) | |
download | CMake-657fc3a9a719831f9943c552e86e58ae283dad43.zip CMake-657fc3a9a719831f9943c552e86e58ae283dad43.tar.gz CMake-657fc3a9a719831f9943c552e86e58ae283dad43.tar.bz2 |
CMakeDetermineCompilerABI: Parse library arch from versioned paths
Teach CMake how to extract `CMAKE_<LANG>_LIBRARY_ARCHITECTURE` from
versioned paths such as `/usr/lib/gcc/x86_64-linux-gnu/9`. These kind of
paths are generated by NVHPC compilers.
Diffstat (limited to 'Modules/CMakeDetermineCompilerABI.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompilerABI.cmake | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 67c42a2a..cf028f1 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -8,6 +8,7 @@ include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake) include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) +include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake) include(CMakeTestCompilerCommon) function(CMAKE_DETERMINE_COMPILER_ABI lang src) @@ -175,27 +176,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE) set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE) - # Detect library architecture directory name. - if(CMAKE_LIBRARY_ARCHITECTURE_REGEX) - foreach(dir ${implicit_dirs}) - if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$") - get_filename_component(arch "${dir}" NAME) - set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${arch}" PARENT_SCOPE) - break() - endif() - endforeach() - elseif(CMAKE_CXX_COMPILER_ID STREQUAL QCC) - foreach(dir ${implicit_dirs}) - if (dir MATCHES "/lib$") - get_filename_component(assumedArchDir "${dir}" DIRECTORY) - get_filename_component(archParentDir "${assumedArchDir}" DIRECTORY) - if (archParentDir STREQUAL CMAKE_SYSROOT) - get_filename_component(archDirName "${assumedArchDir}" NAME) - set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${archDirName}" PARENT_SCOPE) - break() - endif() - endif() - endforeach() + cmake_parse_library_architecture("${implicit_dirs}" architecture_flag) + if(architecture_flag) + set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${architecture_flag}" PARENT_SCOPE) endif() else() |