Skip to content
Snippets Groups Projects
Commit e60491fc authored by Don Kjer's avatar Don Kjer
Browse files

Adding multi-arch hints to CMake, allowing it to correctly find libraries on...

Adding multi-arch hints to CMake, allowing it to correctly find libraries on multi-arch debian-based systems.
parent a039b7c4
Branches
Tags
No related merge requests found
...@@ -73,19 +73,36 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") ...@@ -73,19 +73,36 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# If someone has specified a word size, use that to determine the # If someone has specified a word size, use that to determine the
# architecture. Otherwise, let the architecture specify the word size. # architecture. Otherwise, let the architecture specify the word size.
if (WORD_SIZE EQUAL 32) if (WORD_SIZE EQUAL 32)
#message(STATUS "WORD_SIZE is 32")
set(ARCH i686) set(ARCH i686)
elseif (WORD_SIZE EQUAL 64) elseif (WORD_SIZE EQUAL 64)
#message(STATUS "WORD_SIZE is 64")
set(ARCH x86_64) set(ARCH x86_64)
else (WORD_SIZE EQUAL 32) else (WORD_SIZE EQUAL 32)
#message(STATUS "WORD_SIZE is UNDEFINED")
execute_process(COMMAND uname -m COMMAND sed s/i.86/i686/ execute_process(COMMAND uname -m COMMAND sed s/i.86/i686/
OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
if (ARCH STREQUAL x86_64) if (ARCH STREQUAL x86_64)
#message(STATUS "ARCH is detected as 64; ARCH is ${ARCH}")
set(WORD_SIZE 64) set(WORD_SIZE 64)
else (ARCH STREQUAL x86_64) else (ARCH STREQUAL x86_64)
#message(STATUS "ARCH is detected as 32; ARCH is ${ARCH}")
set(WORD_SIZE 32) set(WORD_SIZE 32)
endif (ARCH STREQUAL x86_64) endif (ARCH STREQUAL x86_64)
endif (WORD_SIZE EQUAL 32) endif (WORD_SIZE EQUAL 32)
if (WORD_SIZE EQUAL 32)
set(DEB_ARCHITECTURE i386)
else (WORD_SIZE EQUAL 32)
set(DEB_ARCHITECTURE amd64)
endif (WORD_SIZE EQUAL 32)
execute_process(COMMAND dpkg-architecture -a${DEB_ARCHITECTURE} -qDEB_HOST_MULTIARCH RESULT_VARIABLE DPKG_RESULT OUTPUT_VARIABLE DPKG_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
#message (STATUS "DPKG_RESULT ${DPKG_RESULT}, DPKG_ARCH ${DPKG_ARCH}")
if (DPKG_RESULT EQUAL 0)
set(CMAKE_LIBRARY_ARCHITECTURE ${DPKG_ARCH})
endif (DPKG_RESULT EQUAL 0)
set(LL_ARCH ${ARCH}_linux) set(LL_ARCH ${ARCH}_linux)
set(LL_ARCH_DIR ${ARCH}-linux) set(LL_ARCH_DIR ${ARCH}-linux)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment