On 24 April 2015 at 21:00, Gregor Jasny <gja...@googlemail.com> wrote:
> 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, yes, indeed.

Thanks!

-- 
Mateusz  Loskot, http://mateusz.loskot.net
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to