Debian Codegraph @

Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/UserMacros/Windows_MT.cmake

raw
1 #
2 # Copyright by The HDF Group.
3 # All rights reserved.
4 #
5 # This file is part of HDF5. The full HDF5 copyright notice, including
6 # terms governing use, modification, and redistribution, is contained in
7 # the COPYING file, which can be found at the root of the source code
8 # distribution tree, or in https://www.hdfgroup.org/licenses.
9 # If you do not have access to either file, you may request a copy from
10 # [email protected].
11 #
12 ########################################################
13 # Include file for user options
14 ########################################################
15
16 # To use this option, copy both the macro and option code
17 # into the root UserMacros.cmake file. Then enable the option,
18 # using the command line add "-DBUILD_STATIC_CRT_LIBS:BOOL=ON"
19 # OR add an include to the root UserMacros.cmake file:
20 # INCLUDE(path_to_file/WINDOWS_MT.cmake)
21
22 #-----------------------------------------------------------------------------
23 # Option to Build with Static CRT libraries on Windows
24 #-------------------------------------------------------------------------------
25 macro (TARGET_STATIC_CRT_FLAGS)
26 if (MSVC AND NOT BUILD_SHARED_LIBS)
27 foreach (flag_var
28 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
29 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
30 CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
31 CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
32 if (${flag_var} MATCHES "/MD")
33 string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
34 endif ()
35 endforeach ()
36 foreach (flag_var
37 CMAKE_Fortran_FLAGS CMAKE_Fortran_FLAGS_DEBUG CMAKE_Fortran_FLAGS_RELEASE
38 CMAKE_Fortran_FLAGS_MINSIZEREL CMAKE_Fortran_FLAGS_RELWITHDEBINFO)
39 if (${flag_var} MATCHES "/libs:dll")
40 string (REGEX REPLACE "/libs:dll" "/libs:static" ${flag_var} "${${flag_var}}")
41 endif ()
42 endforeach ()
43 set (WIN_COMPILE_FLAGS "")
44 set (WIN_LINK_FLAGS "/NODEFAULTLIB:MSVCRT")
45 endif ()
46 endmacro ()
47
48 #-----------------------------------------------------------------------------
49 option (BUILD_STATIC_CRT_LIBS "Build With Static CRT Libraries" OFF)
50 if (BUILD_STATIC_CRT_LIBS)
51 TARGET_STATIC_CRT_FLAGS ()
52 endif ()