From 4fbab87edb6d9986aa1e46b93dfa1d62e3748e13 Mon Sep 17 00:00:00 2001 From: Haoyang Wu Date: Fri, 9 Aug 2024 16:50:49 +0800 Subject: [PATCH] Fix multi-threading runtime library problem on Windows with MSVC --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e50ae94..6ca409bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,18 @@ cmake_minimum_required(VERSION 3.10) +# https://discourse.cmake.org/t/msvc-runtime-library-completely-ignored/10004 +cmake_policy(SET CMP0091 NEW) + project(Bindings DESCRIPTION "Python bindings" ) +# MSVC needs explicit configuration for multithreading +# Select a multi-threaded statically-linked runtime library +# with or without debug information depending on the configuration +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF)