From: Sebastian Pipping Date: Thu, 15 Aug 2019 20:33:22 +0000 (+0200) Subject: CMake: Add suffix w?d?(MT)? to binaries on Windows X-Git-Tag: R_2_2_8~37^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1544741d0365e5a97680a94f4d97e41b38ccb6c6;p=libexpat CMake: Add suffix w?d?(MT)? to binaries on Windows --- diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index 749df81f..62713436 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -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.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}") diff --git a/expat/Changes b/expat/Changes index 896f538d..9449f506 100644 --- a/expat/Changes +++ b/expat/Changes @@ -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)