summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-06-14 17:23:51 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-06-14 17:23:51 (GMT)
commitcc746a6eb788caf90fb3167f1ac681c2764d22ba (patch)
tree925bee52410b0c055cf67d6b96b8f7e5d0f746dd /Modules
parent9c569bea2d4ed9e7290ac7582ce9463af26b1dc3 (diff)
parent1ed19bcb25edc5f1911b5d0237db34426e747cd2 (diff)
downloadCMake-cc746a6eb788caf90fb3167f1ac681c2764d22ba.zip
CMake-cc746a6eb788caf90fb3167f1ac681c2764d22ba.tar.gz
CMake-cc746a6eb788caf90fb3167f1ac681c2764d22ba.tar.bz2
Merge topic 'library-multiarch-issue-12037'
1ed19bc multiarch: Set CMAKE_LIBRARY_ARCHITECTURE_REGEX for Linux|Hurd|kFreeBSD 52a6ed2 Test find_package multiarch support (#12037) b41ad3b Teach find_(library|package) about Linux multiarch (#12037)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCCompiler.cmake.in5
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in5
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake11
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in5
-rw-r--r--Modules/Platform/GNU.cmake2
-rw-r--r--Modules/Platform/Linux.cmake3
-rw-r--r--Modules/Platform/kFreeBSD.cmake2
7 files changed, 33 insertions, 0 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 051df4c..04a5cec 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -28,6 +28,7 @@ SET(CMAKE_C_LINKER_PREFERENCE 10)
# Save compiler ABI information.
SET(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@")
SET(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@")
+SET(CMAKE_C_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
IF(CMAKE_C_SIZEOF_DATA_PTR)
SET(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
@@ -37,6 +38,10 @@ IF(CMAKE_C_COMPILER_ABI)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
ENDIF(CMAKE_C_COMPILER_ABI)
+IF(CMAKE_C_LIBRARY_ARCHITECTURE)
+ SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
+ENDIF()
+
SET(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@")
@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index d7ae8d9..ea06526 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -29,6 +29,7 @@ SET(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
SET(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@")
SET(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@")
+SET(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
IF(CMAKE_CXX_SIZEOF_DATA_PTR)
SET(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
@@ -38,6 +39,10 @@ IF(CMAKE_CXX_COMPILER_ABI)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
ENDIF(CMAKE_CXX_COMPILER_ABI)
+IF(CMAKE_CXX_LIBRARY_ARCHITECTURE)
+ SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
+ENDIF()
+
SET(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@")
@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 7f918e6..39d1f17 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -86,6 +86,17 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
SET(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
SET(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" 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()
+ ENDIF()
+
ELSE(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
MESSAGE(STATUS "Detecting ${lang} compiler ABI info - failed")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
index 146a6f2..53d9552 100644
--- a/Modules/CMakeFortranCompiler.cmake.in
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -34,6 +34,7 @@ ENDIF(UNIX)
# Save compiler ABI information.
SET(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@")
SET(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@")
+SET(CMAKE_Fortran_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@")
IF(CMAKE_Fortran_SIZEOF_DATA_PTR AND NOT CMAKE_SIZEOF_VOID_P)
SET(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}")
@@ -43,5 +44,9 @@ IF(CMAKE_Fortran_COMPILER_ABI)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}")
ENDIF(CMAKE_Fortran_COMPILER_ABI)
+IF(CMAKE_Fortran_LIBRARY_ARCHITECTURE)
+ SET(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@")
+ENDIF()
+
SET(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@")
SET(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@")
diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake
index e0ed86c..4bcfd51 100644
--- a/Modules/Platform/GNU.cmake
+++ b/Modules/Platform/GNU.cmake
@@ -8,4 +8,6 @@ SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*")
+
INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index 6490dd1..38f469b 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -45,6 +45,9 @@ ELSE(DEFINED CMAKE_INSTALL_SO_NO_EXE)
ENDIF(EXISTS "/etc/debian_version")
ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
+# Match multiarch library directory names.
+SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*")
+
INCLUDE(Platform/UnixPaths)
# Debian has lib64 paths only for compatibility so they should not be
diff --git a/Modules/Platform/kFreeBSD.cmake b/Modules/Platform/kFreeBSD.cmake
index ff050de..c1295fb 100644
--- a/Modules/Platform/kFreeBSD.cmake
+++ b/Modules/Platform/kFreeBSD.cmake
@@ -1,2 +1,4 @@
# kFreeBSD looks just like Linux.
INCLUDE(Platform/Linux)
+
+SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*")