How to detect if 64 bit MSVC with cmake?

The usual way to check if you’re generating for a 64 bits architecture is to test CMAKE_SIZEOF_VOID_P:

project( ... )
...

# won't work before project()!    
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    # 64 bits
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
    # 32 bits
endif()

This variable is only set after the project command!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)