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()
Now the other issue is that this target is only designed for MSVC 32bit. So how can I detect that the generator is MSVC64 and skip this target?
The usual way to check if you're generating for a 64 bits architecture is to test CMAKE_SIZEOF_VOID_P:
There are several ways - also used by CMake itself - that will check for "not 64Bit":
References
CMAKE_GENERATOR
CMAKE_SIZEOF_VOID_P
CMAKE_CL_64