1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
5 cmake_policy(SET CMP0053 NEW)
6 cmake_policy(SET CMP0054 NEW)
8 # Function parse implicit linker options.
9 # This is used internally by CMake and should not be included by user
12 function(cmake_parse_library_architecture lang implicit_dirs implicit_objs output_var)
14 # Detect library architecture directory name.
15 if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
16 foreach(dir IN LISTS implicit_dirs)
17 if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
18 get_filename_component(arch "${dir}" NAME)
19 set(library_arch "${arch}")
24 foreach(obj IN LISTS implicit_objs)
25 get_filename_component(dir "${obj}" DIRECTORY)
26 if("${dir}" MATCHES "(/usr)?/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
27 get_filename_component(arch "${dir}" NAME)
28 set(library_arch "${arch}")
34 if(CMAKE_CXX_COMPILER_ID STREQUAL QCC)
35 foreach(dir ${implicit_dirs})
36 if (dir MATCHES "/lib$")
37 get_filename_component(assumedArchDir "${dir}" DIRECTORY)
38 get_filename_component(archParentDir "${assumedArchDir}" DIRECTORY)
39 if (archParentDir STREQUAL CMAKE_SYSROOT)
40 get_filename_component(archDirName "${assumedArchDir}" NAME)
41 set(library_arch "${archDirName}")
50 set(${output_var} "${library_arch}" PARENT_SCOPE)