CMake: Add suffix w?d?(MT)? to binaries on Windows

This commit is contained in:
Sebastian Pipping 2019-08-15 22:33:22 +02:00
parent 36ecc4dc12
commit 1544741d03
2 changed files with 29 additions and 1 deletions

View 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}")

View 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)