summaryrefslogtreecommitdiffstats
path: root/UserMacros.cmake
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2013-06-10 20:39:00 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2013-06-10 20:39:00 (GMT)
commit8f0c245f727ad226cef00afc73fc25f7ef59f1f3 (patch)
tree2e1b2edd4e28af4ebd10bee0cde4276e09ef65cb /UserMacros.cmake
parent7e2733da8cd2502d224a3dc6975f3dec12548838 (diff)
downloadhdf5-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
Diffstat (limited to 'UserMacros.cmake')
-rw-r--r--UserMacros.cmake39
1 files changed, 29 insertions, 10 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