]> granicus.if.org Git - libexpat/commitdiff
CMake: Add suffix w?d?(MT)? to binaries on Windows
authorSebastian Pipping <sebastian@pipping.org>
Thu, 15 Aug 2019 20:33:22 +0000 (22:33 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 17 Aug 2019 20:53:48 +0000 (22:53 +0200)
expat/CMakeLists.txt
expat/Changes

index 749df81f167b7c646826970fe505396633eba7e6..62713436f80988b183d3254d02fbb83ccc0af065 100644 (file)
@@ -182,7 +182,28 @@ if(MSVC)
     add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996)
 endif(MSVC)
 if(WIN32)
-    set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add a suffix, usually d on Windows")
+    if(XML_UNICODE_WCHAR_T)
+        set(_POSTFIX_WIDE "w")
+    endif()
+
+    if(MSVC_USE_STATIC_CRT)
+        set(_POSTFIX_CRT "MT")
+    endif()
+
+    foreach(postfix_var
+            CMAKE_DEBUG_POSTFIX
+            CMAKE_RELEASE_POSTFIX
+            CMAKE_MINSIZEREL_POSTFIX
+            CMAKE_RELWITHDEBINFO_POSTFIX
+            )
+        if(postfix_var STREQUAL "CMAKE_DEBUG_POSTFIX")
+            set(_POSTFIX_DEBUG "d")
+        else()
+            set(_POSTFIX_DEBUG "")
+        endif()
+
+        set(${postfix_var} "${_POSTFIX_WIDE}${_POSTFIX_DEBUG}${_POSTFIX_CRT}" CACHE STRING "Windows binary postfix, e.g. expat<postfix=[w][d][MT]>.dll")
+    endforeach()
 endif(WIN32)
 
 #
@@ -319,6 +340,7 @@ if(XML_UNICODE)
 else()
     set(_EXPAT_CHAR_TYPE "char")
 endif()
+string(TOUPPER "${CMAKE_BUILD_TYPE}" _EXPAT_BUILD_TYPE_UPPER)
 
 message(STATUS "===========================================================================")
 message(STATUS "")
@@ -329,6 +351,9 @@ if(WIN32)
     message(STATUS "  Static CRT ................. ${MSVC_USE_STATIC_CRT}")
 endif()
 message(STATUS "  Character type ............. ${_EXPAT_CHAR_TYPE}")
+if(WIN32)
+    message(STATUS "  Binary postfix ............. ${CMAKE_${_EXPAT_BUILD_TYPE_UPPER}_POSTFIX}")
+endif()
 message(STATUS "")
 message(STATUS "  Build documentation ........ ${BUILD_doc}")
 message(STATUS "  Build examples ............. ${BUILD_examples}")
index 896f538db31fe35b82abb629d91869493eee2e83..9449f50640f1ee110f1160ae01163cde30fb8b7f 100644 (file)
@@ -25,6 +25,9 @@ Release x.x.x xxx xxx xx xxxx
                   CMake: Now produces a summary of applied configuration
                   CMake: Require C++ compiler only when tests are enabled
             #265  CMake: Fix linking with MinGW
+            #316  CMake: Windows: Make binary postfix match MSVC
+                    Old: expat[d].lib
+                    New: expat[w][d][MT].lib
                   CMake: Migrate files from Windows to Unix line endings
        #299 #302  Windows: Replace LoadLibrary hack to access
                     unofficial API function SystemFunction036 (RtlGenRandom)