diff --git a/CMakeLists.txt b/CMakeLists.txt index 96a3ea43e..52f51ba09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25) project(onnxruntime_extensions LANGUAGES C CXX) # set(CMAKE_VERBOSE_MAKEFILE ON) -if(NOT CMAKE_BUILD_TYPE) +if(NOT WIN32 AND NOT CMAKE_BUILD_TYPE) message(STATUS "Build type not set - using RelWithDebInfo") set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose build type: Debug Release RelWithDebInfo." FORCE) endif() @@ -105,6 +105,11 @@ if(NOT CC_OPTIMIZE) endif() if (MSVC) + if (OCOS_ENABLE_STATIC_LIB) + add_compile_options(/MT$<$,$>:d>) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$,$>:Debug>") + endif () + check_cxx_compiler_flag(-sdl HAS_SDL) check_cxx_compiler_flag(-Qspectre HAS_QSPECTRE) if (HAS_QSPECTRE)