add pdb files to packages for MSVC builds
@@ -25,7 +25,7 @@ PROJECT(hiredis VERSION "${VERSION}")
# Hiredis requires C99
SET(CMAKE_C_STANDARD 99)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
-SET(CMAKE_DEBUG_POSTFIX d) # so debug and optimized can be packaged together
+SET(CMAKE_DEBUG_POSTFIX d)
SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples")
@@ -51,6 +51,10 @@ ADD_LIBRARY(hiredis_static STATIC ${hiredis_sources})
SET_TARGET_PROPERTIES(hiredis
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE
VERSION "${HIREDIS_SONAME}")
+SET_TARGET_PROPERTIES(hiredis_static
+ PROPERTIES COMPILE_PDB_NAME hiredis_static)
+SET_TARGET_PROPERTIES(hiredis_static
+ PROPERTIES COMPILE_PDB_NAME_DEBUG hiredis_static${CMAKE_DEBUG_POSTFIX})
IF(WIN32 OR MINGW)
TARGET_LINK_LIBRARIES(hiredis PUBLIC ws2_32 crypt32)
TARGET_LINK_LIBRARIES(hiredis_static PUBLIC ws2_32 crypt32)
@@ -93,6 +97,15 @@ INSTALL(TARGETS hiredis hiredis_static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+if (MSVC)
+ INSTALL(FILES $<TARGET_PDB_FILE:hiredis>
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ CONFIGURATIONS Debug RelWithDebInfo)
+ INSTALL(FILES $<TARGET_FILE_DIR:hiredis_static>/$<TARGET_FILE_BASE_NAME:hiredis_static>.pdb
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ CONFIGURATIONS Debug RelWithDebInfo)
+endif()
+
# For NuGet packages
INSTALL(FILES hiredis.targets
DESTINATION build/native)
@@ -148,6 +161,10 @@ IF(ENABLE_SSL)
PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
VERSION "${HIREDIS_SONAME}")
+ SET_TARGET_PROPERTIES(hiredis_ssl_static
+ PROPERTIES COMPILE_PDB_NAME hiredis_ssl_static)
+ SET_TARGET_PROPERTIES(hiredis_ssl_static
+ PROPERTIES COMPILE_PDB_NAME_DEBUG hiredis_ssl_static${CMAKE_DEBUG_POSTFIX})
TARGET_INCLUDE_DIRECTORIES(hiredis_ssl PRIVATE "${OPENSSL_INCLUDE_DIR}")
TARGET_INCLUDE_DIRECTORIES(hiredis_ssl_static PRIVATE "${OPENSSL_INCLUDE_DIR}")
@@ -165,6 +182,15 @@ IF(ENABLE_SSL)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ if (MSVC)
+ INSTALL(FILES $<TARGET_PDB_FILE:hiredis_ssl>
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ CONFIGURATIONS Debug RelWithDebInfo)
+ INSTALL(FILES $<TARGET_FILE_DIR:hiredis_ssl_static>/$<TARGET_FILE_BASE_NAME:hiredis_ssl_static>.pdb
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ CONFIGURATIONS Debug RelWithDebInfo)
+ endif()
+
INSTALL(FILES hiredis_ssl.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis)
