I have a project which uses cmake, one target is set to only build with MSVC:
if (MSVC) add_library(test SHARED source.cpp) endif()
The usual way to check if you're generating for a 64 bits architecture is to test CMAKE_SIZEOF_VOID_P:
if(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64 bits elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) # 32 bits endif()