From 4a461efae6fa36aeb50e61e381dc2ecf95b83d23 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 25 Nov 2023 20:30:58 +0100 Subject: CMake/Windows/MSVC: Add option to select MSVC Runtime Selects MSVC compiler/build options known as /MT, /MTd, /MD, or /MDd. This applies to "Visual Studio" (IDE) and "NMake Makefiles" builds. --- CMake/options.cmake | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'CMake') diff --git a/CMake/options.cmake b/CMake/options.cmake index 6e2443cfb..5dad843d0 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -77,6 +77,24 @@ set (OPTION_ABI_VERSION "" ) set (FL_ABI_VERSION ${OPTION_ABI_VERSION}) + +####################################################################### +# Select MSVC (Visual Studio) Runtime: DLL (/MDx) or static (/MTx) +# where x = 'd' for Debug builds, empty ('') for non-Debug builds. +# Note: this might be handled better by the 'MSVC_RUNTIME_LIBRARY' +# target property for each target rather than setting a global +# CMake variable - but this version does the latter. +####################################################################### + +if (MSVC) + option (FLTK_MSVC_RUNTIME_DLL "use MSVC Runtime-DLL (/MDx)" ON) + if (FLTK_MSVC_RUNTIME_DLL) + set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + else () + set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif () +endif (MSVC) + ####################################################################### # Bundled Library Options ####################################################################### -- cgit v1.2.3