From 877364f0509c9a54f2d7015a6a9b52b4c7c99edc Mon Sep 17 00:00:00 2001 From: Miriam Zimmerman Date: Mon, 16 Sep 2024 19:56:53 -0400 Subject: [PATCH] windows: Set debug options if appropriate. (#798) * windows: Set debug options if appropriate. If building with debug, also build standard libraries with debug. This ensures that any libraries linking against cubeb won't have mismatched symbol definitions. * Properly allow dynamic linking. * Set global CMAKE_MSVC_RUNTIME_LIBRARY. This variable will apply to all targets, rather than needing to apply a per-target setting. * remove unnecessary whitespace * Simplify variable expression --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c65c00a6..a5573ab3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ # TODO # - backend selection via command line, rather than simply detecting headers. -cmake_minimum_required(VERSION 3.14 FATAL_ERROR) +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) +cmake_policy(SET CMP0091 NEW) project(cubeb VERSION 0.0.0) @@ -12,6 +13,8 @@ option(BUILD_TOOLS "Build tools" ON) option(BUNDLE_SPEEX "Bundle the speex library" OFF) option(LAZY_LOAD_LIBS "Lazily load shared libraries" ON) option(USE_SANITIZERS "Use sanitizers" ON) +# Set debugging for runtime libraries if requested. +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING