From ca951fe674e6dd0c54d7c4530000cd9a7736c9fe Mon Sep 17 00:00:00 2001 From: Michael Hept Date: Mon, 7 Feb 2022 01:38:35 +0100 Subject: [PATCH] Add option to disable use of static runtime --- CMakeLists.txt | 2 ++ pm_common/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fbbd2f..f5ce835 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,8 @@ set(LIBRARY_VERSION "${VERSION}") option(BUILD_SHARED_LIBS "Build shared libraries" ON) +option(PM_USE_STATIC_RUNTIME "Use MSVC static runtime" ON) + # Always build with position-independent code (-fPIC) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/pm_common/CMakeLists.txt b/pm_common/CMakeLists.txt index 9eb3375..6e11a33 100644 --- a/pm_common/CMakeLists.txt +++ b/pm_common/CMakeLists.txt @@ -123,7 +123,7 @@ elseif(WIN32) ${PMDIR}/pm_win/pmwinmm.c) set(PM_NEEDED_LIBS winmm PARENT_SCOPE) target_link_libraries(portmidi PRIVATE winmm) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_SHARED_LIBS AND PM_USE_STATIC_RUNTIME) # /MDd is multithread debug DLL, /MTd is multithread debug # /MD is multithread DLL, /MT is multithread. Change to static: include(../pm_win/static.cmake)