diff --git a/CMakeLists.txt b/CMakeLists.txt index 800bf47ca9f7..f726260053d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,11 +44,14 @@ endif() project(ncnn) -if(MSVC AND NOT CMAKE_VERSION VERSION_LESS "3.15") - option(NCNN_BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for statically linked ncnn" OFF) - if(NCNN_BUILD_WITH_STATIC_CRT) - # cmake before version 3.15 not work - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +if(MSVC) + add_compile_options(/MP) + if(NOT CMAKE_VERSION VERSION_LESS "3.15") + option(NCNN_BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for statically linked ncnn" OFF) + if(NCNN_BUILD_WITH_STATIC_CRT) + # cmake before version 3.15 not work + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif() endif() endif()