Generate and install hiredis.pc

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
master
Justin Brewer 2019-01-21 13:42:58 -06:00 committed by Mark Nunberg
parent edfab35cdc
commit 9ea7ddec0c
2 changed files with 19 additions and 2 deletions

View File

@ -18,7 +18,8 @@ getVersionBit(HIREDIS_MAJOR)
getVersionBit(HIREDIS_MINOR)
getVersionBit(HIREDIS_PATCH)
MESSAGE("Detected version: ${HIREDIS_MAJOR}.${HIREDIS_MINOR}.${HIREDIS_PATCH}")
SET(VERSION "${HIREDIS_MAJOR}.${HIREDIS_MINOR}.${HIREDIS_PATCH}")
MESSAGE("Detected version: ${VERSION}")
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
@ -32,7 +33,9 @@ ADD_LIBRARY(hiredis SHARED
SET_TARGET_PROPERTIES(hiredis
PROPERTIES
VERSION "${HIREDIS_MAJOR}.${HIREDIS_MINOR}.${HIREDIS_PATCH}")
VERSION "${VERSION}")
CONFIGURE_FILE(hiredis.pc.in hiredis.pc @ONLY)
INSTALL(TARGETS hiredis
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
@ -40,6 +43,9 @@ INSTALL(TARGETS hiredis
INSTALL(FILES hiredis.h read.h sds.h async.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hiredis.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# Add tests: Currently, I don't know how to make the tests actually run
# without hanging!
ENABLE_TESTING()

11
hiredis.pc.in Normal file
View File

@ -0,0 +1,11 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
pkgincludedir=${includedir}/hiredis
Name: hiredis
Description: Minimalistic C client library for Redis.
Version: @VERSION@
Libs: -L${libdir} -lhiredis
Cflags: -I${pkgincludedir} -D_FILE_OFFSET_BITS=64