From cf40f73c4019a08de47da53f0c7f1d8ae0e9af32 Mon Sep 17 00:00:00 2001 From: Andreas Schuh Date: Thu, 20 Mar 2014 20:56:05 +0000 Subject: [PATCH] Set package architecture to i386 when compiling with -m32. --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 759fcb2..faefdd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -375,6 +375,25 @@ if (BUILD_PACKAGING) endif () else () string (TOLOWER "${CMAKE_SYSTEM_NAME}" CPACK_SYSTEM_NAME) + if (CMAKE_CXX_FLAGS MATCHES "-m32") + set (CPACK_PACKAGE_ARCHITECTURE i386) + else () + execute_process ( + COMMAND dpkg --print-architecture + RESULT_VARIABLE RV + OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE + ) + if (RV EQUAL 0) + string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE) + else () + execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE) + if (CPACK_PACKAGE_ARCHITECTURE MATCHES "x86_64") + set (CPACK_PACKAGE_ARCHITECTURE amd64) + else () + set (CPACK_PACKAGE_ARCHITECTURE i386) + endif () + endif () + endif () endif () # source package settings