From a3bc9162e6b4b1bd79ac11b2d9f15066261c0540 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 3 Jun 2021 15:27:16 +0200 Subject: [PATCH 1/9] CMake: Move _EXPAT_BUILD_TYPE_UPPER up for upcoming re-use --- expat/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index cd12a992..78718a63 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -106,6 +106,7 @@ if(DEFINED BUILD_SHARED_LIBS) else() set(_EXPAT_SHARED_LIBS_DEFAULT ON) endif() +string(TOUPPER "${CMAKE_BUILD_TYPE}" _EXPAT_BUILD_TYPE_UPPER) # # Configuration @@ -729,7 +730,6 @@ elseif(EXPAT_CHAR_TYPE STREQUAL "wchar_t") else() set(_EXPAT_CHAR_TYPE_SUMMARY "ERROR") endif() -string(TOUPPER "${CMAKE_BUILD_TYPE}" _EXPAT_BUILD_TYPE_UPPER) message(STATUS "===========================================================================") message(STATUS "") From b73c80a727feee73843221a13c816334d8ab2ba6 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sat, 5 Jun 2021 17:12:02 +0200 Subject: [PATCH 2/9] CMake: Avoid empty CMAKE_BUILD_TYPE --- expat/CMakeLists.txt | 3 +++ expat/cmake/autotools/expat-noconfig__linux.cmake.in | 4 ++-- expat/cmake/autotools/expat-noconfig__macos.cmake.in | 4 ++-- expat/cmake/autotools/expat-noconfig__windows.cmake.in | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index 78718a63..fcd0c39a 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -106,6 +106,9 @@ if(DEFINED BUILD_SHARED_LIBS) else() set(_EXPAT_SHARED_LIBS_DEFAULT ON) endif() +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE NoConfig) # so that accessing CMAKE_*_POSTFIX will be waterproof +endif() string(TOUPPER "${CMAKE_BUILD_TYPE}" _EXPAT_BUILD_TYPE_UPPER) # diff --git a/expat/cmake/autotools/expat-noconfig__linux.cmake.in b/expat/cmake/autotools/expat-noconfig__linux.cmake.in index 39595048..2726e488 100644 --- a/expat/cmake/autotools/expat-noconfig__linux.cmake.in +++ b/expat/cmake/autotools/expat-noconfig__linux.cmake.in @@ -1,11 +1,11 @@ #---------------------------------------------------------------- -# Generated CMake target import file. +# Generated CMake target import file for configuration "NoConfig". #---------------------------------------------------------------- # Commands may need to know the format version. set(CMAKE_IMPORT_FILE_VERSION 1) -# Import target "expat::expat" for configuration "" +# Import target "expat::expat" for configuration "NoConfig" set_property(TARGET expat::expat APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) set_target_properties(expat::expat PROPERTIES IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/@LIBDIR_BASENAME@/libexpat.so.@SO_MAJOR@.@SO_MINOR@.@SO_PATCH@" diff --git a/expat/cmake/autotools/expat-noconfig__macos.cmake.in b/expat/cmake/autotools/expat-noconfig__macos.cmake.in index b6b1016c..0485cc63 100644 --- a/expat/cmake/autotools/expat-noconfig__macos.cmake.in +++ b/expat/cmake/autotools/expat-noconfig__macos.cmake.in @@ -1,11 +1,11 @@ #---------------------------------------------------------------- -# Generated CMake target import file. +# Generated CMake target import file for configuration "NoConfig". #---------------------------------------------------------------- # Commands may need to know the format version. set(CMAKE_IMPORT_FILE_VERSION 1) -# Import target "expat::expat" for configuration "" +# Import target "expat::expat" for configuration "NoConfig" set_property(TARGET expat::expat APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) set_target_properties(expat::expat PROPERTIES IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/@LIBDIR_BASENAME@/libexpat.@SO_MAJOR@.@SO_MINOR@.@SO_PATCH@.dylib" diff --git a/expat/cmake/autotools/expat-noconfig__windows.cmake.in b/expat/cmake/autotools/expat-noconfig__windows.cmake.in index 66b2f5cb..78e1430b 100644 --- a/expat/cmake/autotools/expat-noconfig__windows.cmake.in +++ b/expat/cmake/autotools/expat-noconfig__windows.cmake.in @@ -1,11 +1,11 @@ #---------------------------------------------------------------- -# Generated CMake target import file. +# Generated CMake target import file for configuration "NoConfig". #---------------------------------------------------------------- # Commands may need to know the format version. set(CMAKE_IMPORT_FILE_VERSION 1) -# Import target "expat::expat" for configuration "" +# Import target "expat::expat" for configuration "NoConfig" set_property(TARGET expat::expat APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) set_target_properties(expat::expat PROPERTIES IMPORTED_IMPLIB_NOCONFIG "${_IMPORT_PREFIX}/@LIBDIR_BASENAME@/libexpat.dll.a" From 7cf97a9bda1b67cd2adba6d972b693aff0d8b875 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Wed, 23 Jun 2021 20:23:09 +0200 Subject: [PATCH 3/9] CMake: Apply -DEXPAT_MSVC_STATIC_CRT=ON to off-grid built types --- expat/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index fcd0c39a..c6b0172f 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -306,10 +306,12 @@ if (MSVC) if (EXPAT_MSVC_STATIC_CRT) message("-- Using static CRT ${EXPAT_MSVC_STATIC_CRT}") foreach(flag_var + CMAKE_CXX_FLAGS_${_EXPAT_BUILD_TYPE_UPPER} CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_${_EXPAT_BUILD_TYPE_UPPER} CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL From 3486fd6e3d2bc269660cedd3befa1ae649d1dcf4 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 3 Jun 2021 15:41:47 +0200 Subject: [PATCH 4/9] CMake: Fix pkg-config section "Libs" for non-release MinGW builds --- expat/CMakeLists.txt | 78 +++++++++++++++++++++----------------------- expat/Changes | 5 +++ expat/configure.ac | 4 +-- expat/expat.pc.in | 4 +-- 4 files changed, 46 insertions(+), 45 deletions(-) diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index c6b0172f..ae9cdb69 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -326,35 +326,38 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib) if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996) endif() -if(WIN32) - if(_EXPAT_UNICODE_WCHAR_T) - set(_POSTFIX_WIDE "w") - endif() - if(MSVC AND NOT EXPAT_SHARED_LIBS) - if(EXPAT_MSVC_STATIC_CRT) - set(_POSTFIX_CRT "MT") - else() - set(_POSTFIX_CRT "MD") - endif() - 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. libexpat.lib") - endforeach() +# +# Library filename postfix +# +if(_EXPAT_UNICODE) + set(_POSTFIX_WIDE "w") endif() +if(MSVC AND NOT EXPAT_SHARED_LIBS) + if(EXPAT_MSVC_STATIC_CRT) + set(_POSTFIX_CRT "MT") + else() + set(_POSTFIX_CRT "MD") + endif() +endif() + +foreach(postfix_var + CMAKE_${_EXPAT_BUILD_TYPE_UPPER}_POSTFIX + CMAKE_DEBUG_POSTFIX + CMAKE_RELEASE_POSTFIX + CMAKE_MINSIZEREL_POSTFIX + CMAKE_RELWITHDEBINFO_POSTFIX + ) + if(WIN32 AND postfix_var STREQUAL "CMAKE_DEBUG_POSTFIX") + set(_POSTFIX_DEBUG "d") + else() + set(_POSTFIX_DEBUG "") # needs a reset because of being looped + endif() + + set(${postfix_var} "${_POSTFIX_WIDE}${_POSTFIX_DEBUG}${_POSTFIX_CRT}" CACHE STRING "Library filename postfix, e.g. libexpat.lib") +endforeach() + # # C library # @@ -376,17 +379,6 @@ else() set(_SHARED STATIC) endif() -# Avoid colliding with Expat.dll of Perl's XML::Parser::Expat -if(WIN32 AND NOT MINGW) - set(_EXPAT_OUTPUT_NAME libexpat) # CMAKE_*_POSTFIX applies, see above -else() - if(_EXPAT_UNICODE) - set(_EXPAT_OUTPUT_NAME expatw) - else() - set(_EXPAT_OUTPUT_NAME expat) - endif() -endif() - add_library(expat ${_SHARED} ${expat_SRCS}) if(EXPAT_WITH_LIBBSD) target_link_libraries(expat ${LIB_BSD}) @@ -397,12 +389,17 @@ set(LIBREVISION 1) # with set(LIBAGE 8) # configure.ac! math(EXPR LIBCURRENT_MINUS_AGE "${LIBCURRENT} - ${LIBAGE}") -set_property(TARGET expat PROPERTY OUTPUT_NAME "${_EXPAT_OUTPUT_NAME}") if(NOT WIN32) set_property(TARGET expat PROPERTY VERSION ${LIBCURRENT_MINUS_AGE}.${LIBAGE}.${LIBREVISION}) set_property(TARGET expat PROPERTY SOVERSION ${LIBCURRENT_MINUS_AGE}) set_property(TARGET expat PROPERTY NO_SONAME ${NO_SONAME}) endif() +if(WIN32 AND NOT MINGW) + # NOTE: This avoids a name collision with Expat.dll of Perl's XML::Parser::Expat + # on Windows by resorting to filename libexpat.dll since Expat 1.95.3. + # Everything but MSVC is already adding prefix "lib", automatically. + set_property(TARGET expat PROPERTY PREFIX lib) +endif() target_include_directories(expat INTERFACE @@ -428,6 +425,7 @@ expat_install(FILES lib/expat.h lib/expat_external.h DESTINATION ${CMAKE_INSTALL if(EXPAT_BUILD_PKGCONFIG) set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix "\${prefix}") + set(_EXPAT_LIBRARY_NAME "expat${CMAKE_${_EXPAT_BUILD_TYPE_UPPER}_POSTFIX}") if(CMAKE_INSTALL_LIBDIR MATCHES "^/") set(libdir "${CMAKE_INSTALL_LIBDIR}") @@ -746,9 +744,7 @@ if(MSVC) message(STATUS " Static CRT ................. ${EXPAT_MSVC_STATIC_CRT}") endif() message(STATUS " Character type ............. ${_EXPAT_CHAR_TYPE_SUMMARY}") -if(WIN32) - message(STATUS " Binary postfix ............. ${CMAKE_${_EXPAT_BUILD_TYPE_UPPER}_POSTFIX}") -endif() +message(STATUS " Library name postfix ....... ${CMAKE_${_EXPAT_BUILD_TYPE_UPPER}_POSTFIX}") message(STATUS "") message(STATUS " Build documentation ........ ${EXPAT_BUILD_DOCS}") message(STATUS " Build examples ............. ${EXPAT_BUILD_EXAMPLES}") diff --git a/expat/Changes b/expat/Changes index 2def0acc..42bae977 100644 --- a/expat/Changes +++ b/expat/Changes @@ -7,6 +7,11 @@ Release 2.4.2 xxx xxx xx xxxx #497 Autotools: Include files with release archives: - buildconf.sh - fuzz/*.c + #495 CMake: MinGW: Fix pkg-config section "Libs" for non-release + build types (e.g. -DCMAKE_BUILD_TYPE=Debug) + + Special thanks to: + Kai Pastor Release 2.4.1 Sun May 23 2021 Bug fixes: diff --git a/expat/configure.ac b/expat/configure.ac index b27b59e8..edc95ea4 100644 --- a/expat/configure.ac +++ b/expat/configure.ac @@ -394,8 +394,8 @@ AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_CXXFLAGS]) AC_SUBST([AM_LDFLAGS]) -dnl updating _EXPAT_OUTPUT_NAME variable to effect the package name in expat.pc file (issue #361) -AC_SUBST(_EXPAT_OUTPUT_NAME, ["$PACKAGE_NAME"]) +dnl updating _EXPAT_LIBRARY_NAME variable to effect the package name in expat.pc file (issues #361 and #495) +AC_SUBST(_EXPAT_LIBRARY_NAME, ["$PACKAGE_NAME"]) AS_CASE("${host_os}", [darwin*], [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__macos.cmake.in], diff --git a/expat/expat.pc.in b/expat/expat.pc.in index bdfa47f8..b6834a69 100644 --- a/expat/expat.pc.in +++ b/expat/expat.pc.in @@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: @_EXPAT_OUTPUT_NAME@ +Name: @_EXPAT_LIBRARY_NAME@ Version: @PACKAGE_VERSION@ Description: expat XML parser URL: http://www.libexpat.org -Libs: -L${libdir} -l@_EXPAT_OUTPUT_NAME@ +Libs: -L${libdir} -l@_EXPAT_LIBRARY_NAME@ Cflags: -I${includedir} From 663e529eed7720585177e93f87ba8f859c74a9ce Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 3 Jun 2021 16:58:23 +0200 Subject: [PATCH 5/9] Update URL in pc file --- expat/expat.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expat/expat.pc.in b/expat/expat.pc.in index b6834a69..3cd2e765 100644 --- a/expat/expat.pc.in +++ b/expat/expat.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: @_EXPAT_LIBRARY_NAME@ Version: @PACKAGE_VERSION@ Description: expat XML parser -URL: http://www.libexpat.org +URL: https://libexpat.github.io/ Libs: -L${libdir} -l@_EXPAT_LIBRARY_NAME@ Cflags: -I${includedir} From 1d4bb74c34c00a357478087998cc72684ae7aa16 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Wed, 23 Jun 2021 19:56:29 +0200 Subject: [PATCH 6/9] CMake: Fix pkg-config section "Libs" for multi-config CMake generators --- expat/CMakeLists.txt | 33 +++++++++++++++++++++++---------- expat/Changes | 6 ++++-- expat/Makefile.am | 1 + expat/expat.pc.cmake | 11 +++++++++++ 4 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 expat/expat.pc.cmake diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index ae9cdb69..18a9c052 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -423,24 +423,37 @@ expat_install(FILES lib/expat.h lib/expat_external.h DESTINATION ${CMAKE_INSTALL # pkg-config file # if(EXPAT_BUILD_PKGCONFIG) - set(prefix ${CMAKE_INSTALL_PREFIX}) - set(exec_prefix "\${prefix}") - set(_EXPAT_LIBRARY_NAME "expat${CMAKE_${_EXPAT_BUILD_TYPE_UPPER}_POSTFIX}") - if(CMAKE_INSTALL_LIBDIR MATCHES "^/") - set(libdir "${CMAKE_INSTALL_LIBDIR}") + set(_expat_pkgconfig_libdir "${CMAKE_INSTALL_LIBDIR}") else() - set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") + set(_expat_pkgconfig_libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") endif() if(CMAKE_INSTALL_INCLUDEDIR MATCHES "^/") - set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") + set(_expat_pkgconfig_includedir "${CMAKE_INSTALL_INCLUDEDIR}") else() - set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + set(_expat_pkgconfig_includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") endif() - configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc @ONLY) - expat_install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + set_target_properties(expat PROPERTIES + pkgconfig_prefix "${CMAKE_INSTALL_PREFIX}" + pkgconfig_exec_prefix "\${prefix}" + pkgconfig_libdir "${_expat_pkgconfig_libdir}" + pkgconfig_includedir "${_expat_pkgconfig_includedir}" + pkgconfig_version "${PACKAGE_VERSION}") + + foreach(_build_type ${CMAKE_BUILD_TYPE} Debug Release RelWithDebInfo MinSizeRel) + string(TOLOWER "${_build_type}" _build_type_lower) + string(TOUPPER "${_build_type}" _build_type_upper) + set_property(TARGET expat PROPERTY "pkgconfig_${_build_type_lower}_name" "expat${CMAKE_${_build_type_upper}_POSTFIX}") + endforeach() + + file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$/expat.pc + INPUT ${PROJECT_SOURCE_DIR}/expat.pc.cmake + TARGET expat) + + expat_install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/expat.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() # diff --git a/expat/Changes b/expat/Changes index 42bae977..ed0f4f2b 100644 --- a/expat/Changes +++ b/expat/Changes @@ -7,10 +7,12 @@ Release 2.4.2 xxx xxx xx xxxx #497 Autotools: Include files with release archives: - buildconf.sh - fuzz/*.c - #495 CMake: MinGW: Fix pkg-config section "Libs" for non-release - build types (e.g. -DCMAKE_BUILD_TYPE=Debug) + #495 CMake: MinGW: Fix pkg-config section "Libs" for + - non-release build types (e.g. -DCMAKE_BUILD_TYPE=Debug) + - multi-config CMake generators (e.g. Ninja Multi-Config) Special thanks to: + Joergen Ibsen Kai Pastor Release 2.4.1 Sun May 23 2021 diff --git a/expat/Makefile.am b/expat/Makefile.am index 4ff5c8ab..e6e7971e 100644 --- a/expat/Makefile.am +++ b/expat/Makefile.am @@ -75,6 +75,7 @@ _EXTRA_DIST_CMAKE = \ CMakeLists.txt \ CMake.README \ ConfigureChecks.cmake \ + expat.pc.cmake \ expat_config.h.cmake _EXTRA_DIST_WINDOWS = \ diff --git a/expat/expat.pc.cmake b/expat/expat.pc.cmake new file mode 100644 index 00000000..89a401af --- /dev/null +++ b/expat/expat.pc.cmake @@ -0,0 +1,11 @@ +prefix=$ +exec_prefix=$ +libdir=$ +includedir=$ + +Name: $>_name> +Version: $ +Description: expat XML parser +URL: https://libexpat.github.io/ +Libs: -L${libdir} -l$>_name> +Cflags: -I${includedir} From 19dd50990def0229b18dfdc2a9a2ab6f3491f9de Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Wed, 23 Jun 2021 20:41:38 +0200 Subject: [PATCH 7/9] Autotools: Simplify expat.pc templating (now that we can) --- expat/configure.ac | 3 --- expat/expat.pc.in | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/expat/configure.ac b/expat/configure.ac index edc95ea4..6c1016e1 100644 --- a/expat/configure.ac +++ b/expat/configure.ac @@ -394,9 +394,6 @@ AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_CXXFLAGS]) AC_SUBST([AM_LDFLAGS]) -dnl updating _EXPAT_LIBRARY_NAME variable to effect the package name in expat.pc file (issues #361 and #495) -AC_SUBST(_EXPAT_LIBRARY_NAME, ["$PACKAGE_NAME"]) - AS_CASE("${host_os}", [darwin*], [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__macos.cmake.in], [mingw*], [CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__windows.cmake.in], diff --git a/expat/expat.pc.in b/expat/expat.pc.in index 3cd2e765..3a1a4609 100644 --- a/expat/expat.pc.in +++ b/expat/expat.pc.in @@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: @_EXPAT_LIBRARY_NAME@ +Name: @PACKAGE_NAME@ Version: @PACKAGE_VERSION@ Description: expat XML parser URL: https://libexpat.github.io/ -Libs: -L${libdir} -l@_EXPAT_LIBRARY_NAME@ +Libs: -L${libdir} -l@PACKAGE_NAME@ Cflags: -I${includedir} From 40bf9fe84aa58c13b3c8de39495f9a1cabd4ab7c Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Wed, 23 Jun 2021 21:12:32 +0200 Subject: [PATCH 8/9] CMake: Report on effective CMake generator --- expat/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index 18a9c052..fda3f626 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -750,6 +750,7 @@ endif() message(STATUS "===========================================================================") message(STATUS "") message(STATUS "Configuration") +message(STATUS " Generator .................. ${CMAKE_GENERATOR}") message(STATUS " Prefix ..................... ${CMAKE_INSTALL_PREFIX}") message(STATUS " Build type ................. ${CMAKE_BUILD_TYPE}") message(STATUS " Shared libraries ........... ${EXPAT_SHARED_LIBS}") From f9eb8a1286e23ebbea852dfc4067562936a7b885 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Wed, 23 Jun 2021 21:21:26 +0200 Subject: [PATCH 9/9] CMake: Improve summary output for multi-config builds --- expat/CMakeLists.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index fda3f626..dcd9e91f 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -746,19 +746,32 @@ elseif(EXPAT_CHAR_TYPE STREQUAL "wchar_t") else() set(_EXPAT_CHAR_TYPE_SUMMARY "ERROR") endif() +# NOTE: We're not accessing global property GENERATOR_IS_MULTI_CONFIG +# because that would require CMake >=3.9 +if(CMAKE_CONFIGURATION_TYPES) + set(_EXPAT_GENERATOR_IS_MULTI_CONFIG TRUE) +else() + set(_EXPAT_GENERATOR_IS_MULTI_CONFIG FALSE) +endif() message(STATUS "===========================================================================") message(STATUS "") message(STATUS "Configuration") message(STATUS " Generator .................. ${CMAKE_GENERATOR}") +if(_EXPAT_GENERATOR_IS_MULTI_CONFIG) + message(STATUS " Build types ................ ${CMAKE_CONFIGURATION_TYPES}") +else() + message(STATUS " Build type ................. ${CMAKE_BUILD_TYPE}") +endif() message(STATUS " Prefix ..................... ${CMAKE_INSTALL_PREFIX}") -message(STATUS " Build type ................. ${CMAKE_BUILD_TYPE}") message(STATUS " Shared libraries ........... ${EXPAT_SHARED_LIBS}") if(MSVC) message(STATUS " Static CRT ................. ${EXPAT_MSVC_STATIC_CRT}") endif() message(STATUS " Character type ............. ${_EXPAT_CHAR_TYPE_SUMMARY}") -message(STATUS " Library name postfix ....... ${CMAKE_${_EXPAT_BUILD_TYPE_UPPER}_POSTFIX}") +if(NOT _EXPAT_GENERATOR_IS_MULTI_CONFIG) + message(STATUS " Library name postfix ....... ${CMAKE_${_EXPAT_BUILD_TYPE_UPPER}_POSTFIX}") +endif() message(STATUS "") message(STATUS " Build documentation ........ ${EXPAT_BUILD_DOCS}") message(STATUS " Build examples ............. ${EXPAT_BUILD_EXAMPLES}")