From 571e4fd31aaca1f3ced9a82ee2ea537fdd5117c1 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Mon, 11 May 2015 11:16:39 -0500 Subject: [PATCH] Detect 32-bit/64-bit correctly based on CFLAGS The user might invoke cmake with CFLAGS containing "-m32" or (on OS X) "-arch i386" while on a 64-bit machine to indicate that it should build for 32-bit instead. --- cmake/modules/DetectMachine.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/DetectMachine.cmake b/cmake/modules/DetectMachine.cmake index a3eac91cb..a5dc6f541 100644 --- a/cmake/modules/DetectMachine.cmake +++ b/cmake/modules/DetectMachine.cmake @@ -24,7 +24,7 @@ IF(WIN32) SET(IS_X86 TRUE) ENDIF(WIN64) ELSE(WIN32) - EXEC_PROGRAM( ${CMAKE_C_COMPILER} ARGS "-dumpmachine" OUTPUT_VARIABLE Machine ) + EXEC_PROGRAM( ${CMAKE_C_COMPILER} ARGS "-dumpmachine ${CMAKE_C_FLAGS}" OUTPUT_VARIABLE Machine ) MESSAGE("Machine: ${Machine}") STRING(REGEX MATCH "i.86" IS_X86 "${Machine}") STRING(REGEX MATCH "86_64" IS_X86_64 "${Machine}")