Fix Windows debug builds (Bugzilla #2600) using CMake.

This commit is contained in:
Philip.Hazel 2020-06-22 15:51:19 +00:00
parent 3faff02596
commit ed489f99ae
8 changed files with 26 additions and 13 deletions

View File

@ -495,6 +495,12 @@ CONFIGURE_FILE(src/pcre2.h.in
${PROJECT_BINARY_DIR}/pcre2.h
@ONLY)
# Make sure to not link debug libs
# against release libs and vice versa
IF(WIN32)
SET(CMAKE_DEBUG_POSTFIX "d")
ENDIF(WIN32)
# Generate pkg-config files
SET(PACKAGE_VERSION "${PCRE2_MAJOR}.${PCRE2_MINOR}")
@ -503,6 +509,9 @@ SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(exec_prefix "\${prefix}")
SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
SET(includedir "\${prefix}/include")
IF(WIN32 AND (CMAKE_BUILD_TYPE MATCHES Debug))
SET(LIB_POSTFIX ${CMAKE_DEBUG_POSTFIX})
ENDIF()
CONFIGURE_FILE(libpcre2-posix.pc.in libpcre2-posix.pc @ONLY)
SET(pkg_config_files ${pkg_config_files} "${CMAKE_CURRENT_BINARY_DIR}/libpcre2-posix.pc")
@ -642,11 +651,6 @@ IF(MSVC)
ENDIF(MSVC)
SET(CMAKE_INCLUDE_CURRENT_DIR 1)
# needed to make sure to not link debug libs
# against release libs and vice versa
IF(WIN32)
SET(CMAKE_DEBUG_POSTFIX "d")
ENDIF(WIN32)
SET(targets)

View File

@ -40,6 +40,10 @@ platforms.)
6. Added a (uint32_t) cast to prevent a compiler warning in pcre2_compile.c.
7. Applied a patch from Wolfgang Stöggl (Bugzilla #2600) to fix postfix for
debug Windows builds using CMake. This also updated configure so that it
generates *.pc files and pcre2-config with the same content, as in the past.
Version 10.35 09-May-2020
---------------------------

View File

@ -1021,7 +1021,12 @@ if test "$pcre2_cc_cv_intel_cet_enabled" = yes; then
fi
AC_LANG_POP([C])
# LIB_POSTFIX is used by CMakeLists.txt for Windows debug builds.
# Pass empty LIB_POSTFIX to *.pc files and pcre2-config here.
AC_SUBST(LIB_POSTFIX)
# Produce these files, in addition to config.h.
AC_CONFIG_FILES(
Makefile
libpcre2-8.pc

View File

@ -8,6 +8,6 @@ includedir=@includedir@
Name: libpcre2-16
Description: PCRE2 - Perl compatible regular expressions C library (2nd API) with 16 bit character support
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpcre2-16
Libs: -L${libdir} -lpcre2-16@LIB_POSTFIX@
Libs.private: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
Cflags: -I${includedir} @PCRE2_STATIC_CFLAG@

View File

@ -8,6 +8,6 @@ includedir=@includedir@
Name: libpcre2-32
Description: PCRE2 - Perl compatible regular expressions C library (2nd API) with 32 bit character support
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpcre2-32
Libs: -L${libdir} -lpcre2-32@LIB_POSTFIX@
Libs.private: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
Cflags: -I${includedir} @PCRE2_STATIC_CFLAG@

View File

@ -8,6 +8,6 @@ includedir=@includedir@
Name: libpcre2-8
Description: PCRE2 - Perl compatible regular expressions C library (2nd API) with 8 bit character support
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpcre2-8
Libs: -L${libdir} -lpcre2-8@LIB_POSTFIX@
Libs.private: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
Cflags: -I${includedir} @PCRE2_STATIC_CFLAG@

View File

@ -8,6 +8,6 @@ includedir=@includedir@
Name: libpcre2-posix
Description: Posix compatible interface to libpcre2-8
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lpcre2-posix
Libs: -L${libdir} -lpcre2-posix@LIB_POSTFIX@
Cflags: -I${includedir} @PCRE2_STATIC_CFLAG@
Requires.private: libpcre2-8

View File

@ -86,28 +86,28 @@ while test $# -gt 0; do
;;
--libs-posix)
if test @enable_pcre2_8@ = yes ; then
echo $libS$libR -lpcre2-posix -lpcre2-8
echo $libS$libR -lpcre2-posix@LIB_POSTFIX@ -lpcre2-8@LIB_POSTFIX@
else
echo "${usage}" 1>&2
fi
;;
--libs8)
if test @enable_pcre2_8@ = yes ; then
echo $libS$libR -lpcre2-8
echo $libS$libR -lpcre2-8@LIB_POSTFIX@
else
echo "${usage}" 1>&2
fi
;;
--libs16)
if test @enable_pcre2_16@ = yes ; then
echo $libS$libR -lpcre2-16
echo $libS$libR -lpcre2-16@LIB_POSTFIX@
else
echo "${usage}" 1>&2
fi
;;
--libs32)
if test @enable_pcre2_32@ = yes ; then
echo $libS$libR -lpcre2-32
echo $libS$libR -lpcre2-32@LIB_POSTFIX@
else
echo "${usage}" 1>&2
fi