[CMake] Detecting -m32 build target on 64-bit host
Gregor Jasny
gjasny at googlemail.com
Fri Apr 24 15:00:22 EDT 2015
Hi,
On 23/04/15 16:54, Mateusz Loskot wrote:
> Surprisingly, I'm having trouble to figure out how to determine,
> that in Linux 64-bit OS, I'm building a project with -m32 specified.
> IOW, any CMake variable or macro to tell me target architecture
> of a build that is being configured is 32 or 64 bit?
Does this help?
include(CheckSymbolExists)
if(WIN32)
check_symbol_exists("_M_AMD64" "" RTC_ARCH_X64)
if(NOT RTC_ARCH_X64)
check_symbol_exists("_M_IX86" "" RTC_ARCH_X86)
endif(NOT RTC_ARCH_X64)
# add check for arm here
# see http://msdn.microsoft.com/en-us/library/b0084kay.aspx
else(WIN32)
check_symbol_exists("__i386__" "" RTC_ARCH_X86)
check_symbol_exists("__x86_64__" "" RTC_ARCH_X64)
check_symbol_exists("__arm__" "" RTC_ARCH_ARM)
endif(WIN32)
-Gregor
More information about the CMake
mailing list