[CMake] determine 32 vs 64 bit linux

Campbell Barton ideasman42 at gmail.com
Wed Jun 22 21:30:14 EDT 2011


On Wed, Jun 22, 2011 at 11:33 PM, Karl Merkley <karl at elemtech.com> wrote:
>
> I need to install a library into a directory whose name depends on the machine type.   For example
>
> if (WIN32)
>  if (CMAKE_CL_64)
>      set(ARCH_DIR "win32")
>  else()
>      set(ARCH_DIR "win64")
>  endif()
>
> elseif (UNIX)
>  if (????)
>      set(ARCH_DIR "linux32")
>  else()
>     set(ARCH_DIR "linux64")
> endif()
>
> Is there a better way to do this?   The win64 version seems to work correctly.   What variable do I check for 32 vs 64 bit linux?
>
>  Thanks,
>        Karl

Not sure this is the best way but its used in cmake files a bit.

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
....


More information about the CMake mailing list