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.
This commit is contained in:
Albrecht Schlosser
2023-11-25 20:30:58 +01:00
parent e8ad00d9fe
commit 4a461efae6
2 changed files with 23 additions and 0 deletions

View File

@@ -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$<$<CONFIG:Debug>:Debug>DLL")
else ()
set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif ()
endif (MSVC)
#######################################################################
# Bundled Library Options
#######################################################################

View File

@@ -133,6 +133,11 @@ FLTK_BUILD_TEST - default ON
FLTK_BUILD_EXAMPLES - default OFF
Builds the example programs in the 'examples' directory.
FLTK_MSVC_RUNTIME_DLL - default ON (only for Visual Studio and NMake).
Selects whether the build uses the MS runtime DLL or not.
Default is ON: either /MD or /MDd for Release or Debug, respectively.
Select OFF for either /MT or /MTd for Release or Debug, respectively.
OPTION_CAIRO - default OFF
Enables support of class Fl_Cairo_Window (all platforms, requires the
Cairo library) - see README.Cairo.txt.