Windows CMake配置CRT类型

2024年11月5日 0 By Majjcom

参考链接

配置cmake变量CMAKE_MSVC_RUNTIME_LIBRARY,

MultiThreaded
Compile with -MT or equivalent flag(s) to use a multi-threaded statically-linked runtime library.

MultiThreadedDLL
Compile with -MD or equivalent flag(s) to use a multi-threaded dynamically-linked runtime library.

MultiThreadedDebug
Compile with -MTd or equivalent flag(s) to use a multi-threaded statically-linked runtime library.

MultiThreadedDebugDLL
Compile with -MDd or equivalent flag(s) to use a multi-threaded dynamically-linked runtime library.

快速配置:

set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>")