diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2013-06-10 20:39:00 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2013-06-10 20:39:00 (GMT) |
commit | 8f0c245f727ad226cef00afc73fc25f7ef59f1f3 (patch) | |
tree | 2e1b2edd4e28af4ebd10bee0cde4276e09ef65cb | |
parent | 7e2733da8cd2502d224a3dc6975f3dec12548838 (diff) | |
download | hdf5-8f0c245f727ad226cef00afc73fc25f7ef59f1f3.zip hdf5-8f0c245f727ad226cef00afc73fc25f7ef59f1f3.tar.gz hdf5-8f0c245f727ad226cef00afc73fc25f7ef59f1f3.tar.bz2 |
[svn-r23748] HDFFV-8461: Add Windows /MT support
This adds the UserMacros.cmake support needed.
Correct Properties tag name
-rw-r--r-- | UserMacros.cmake | 39 | ||||
-rw-r--r-- | config/cmake/HDFMacros.cmake | 4 |
2 files changed, 31 insertions, 12 deletions
diff --git a/UserMacros.cmake b/UserMacros.cmake index d7d3ef9..bf609e5 100644 --- a/UserMacros.cmake +++ b/UserMacros.cmake @@ -3,15 +3,34 @@ ######################################################## #----------------------------------------------------------------------------- -# Option to Build with User Defined Values -#----------------------------------------------------------------------------- -MACRO (MACRO_USER_DEFINED_LIBS) - SET (USER_DEFINED_VALUE "FALSE") -ENDMACRO (MACRO_USER_DEFINED_LIBS) - +# Option to Build with Static CRT libraries on Windows #------------------------------------------------------------------------------- -OPTION (BUILD_USER_DEFINED_LIBS "Build With User Defined Values" OFF) -IF (BUILD_USER_DEFINED_LIBS) - MACRO_USER_DEFINED_LIBS () -ENDIF (BUILD_USER_DEFINED_LIBS) +MACRO (TARGET_STATIC_CRT_FLAGS) + IF (MSVC AND NOT BUILD_SHARED_LIBS) + FOREACH (flag_var + CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + IF (${flag_var} MATCHES "/MD") + STRING (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + ENDIF (${flag_var} MATCHES "/MD") + ENDFOREACH (flag_var) + FOREACH (flag_var + CMAKE_Fortran_FLAGS CMAKE_Fortran_FLAGS_DEBUG CMAKE_Fortran_FLAGS_RELEASE + CMAKE_Fortran_FLAGS_MINSIZEREL CMAKE_Fortran_FLAGS_RELWITHDEBINFO) + IF (${flag_var} MATCHES "/libs:dll") + STRING (REGEX REPLACE "/libs:dll" "/libs:static" ${flag_var} "${${flag_var}}") + ENDIF (${flag_var} MATCHES "/libs:dll") + ENDFOREACH (flag_var) + SET (WIN_COMPILE_FLAGS "/MT") + SET (WIN_LINK_FLAGS "/NODEFAULTLIB:MSVCRT") + ENDIF (MSVC AND NOT BUILD_SHARED_LIBS) +ENDMACRO (TARGET_STATIC_CRT_FLAGS) + +#----------------------------------------------------------------------------- +OPTION (BUILD_STATIC_CRT_LIBS "Build With Static CRT Libraries" OFF) +IF (BUILD_STATIC_CRT_LIBS) + TARGET_STATIC_CRT_FLAGS () +ENDIF (BUILD_STATIC_CRT_LIBS)
\ No newline at end of file diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index e9e9665..1a2d11b 100644 --- a/config/cmake/HDFMacros.cmake +++ b/config/cmake/HDFMacros.cmake @@ -132,7 +132,7 @@ MACRO (TARGET_C_PROPERTIES wintarget addcompileflags addlinkflags) LINK_FLAGS "${addlinkflags}" ) ELSE (BUILD_SHARED_LIBS) - SET_TARGET_PROPERTIES (${forttarget} + SET_TARGET_PROPERTIES (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}" @@ -151,7 +151,7 @@ MACRO (TARGET_MSVC_PROPERTIES wintarget addcompileflags addlinkflags) LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" ) ELSE (BUILD_SHARED_LIBS) - SET_TARGET_PROPERTIES (${forttarget} + SET_TARGET_PROPERTIES (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" |