How to detect if 64 bit MSVC with cmake?

后端 未结 7 1630
既然无缘
既然无缘 2020-12-09 08:42

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()

7条回答
  •  轮回少年
    2020-12-09 09:10

    The optional solution is to build the condition base on used compiler name.

    if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
    

提交回复
热议问题