From 6728a7582bbd5f0ef37f8893cc0103f82c9fdc05 Mon Sep 17 00:00:00 2001 From: Millian Poquet Date: Thu, 6 Dec 2018 20:01:15 +0100 Subject: [PATCH 1/2] install a pkg-config redox.pc file --- CMakeLists.txt | 3 +++ cmake/redox.pc.in | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 cmake/redox.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 11887ad..54dfa35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,6 +193,9 @@ endif() if (lib) # Install the dynamic library to /usr/lib[64] install(TARGETS redox DESTINATION lib${LIB_SUFFIX}) + # Generate the redox.pc pkg-config file in /usr/lib[64]/pkgconfig + configure_file("${CMAKE_HOME_DIRECTORY}/cmake/redox.pc.in" "${PROJECT_BINARY_DIR}/redox.pc" @ONLY) + install(FILES "${PROJECT_BINARY_DIR}/redox.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig/) endif() if (static_lib) diff --git a/cmake/redox.pc.in b/cmake/redox.pc.in new file mode 100644 index 0000000..a480d1f --- /dev/null +++ b/cmake/redox.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/lib@LIB_SUFFIX@ +includedir=${prefix}/include + +Name: redox +Description: Modern, asynchronous, and wicked fast C++11 client for Redis +Version: @REDOX_VERSION_STRING@ + +Libs: -L${libdir} -lredox @HIREDIS_LIBRARIES@ @LIBEV_LIBRARIES@ @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} From e7904da79d5360ba22fbab64b96be167b6dda5f6 Mon Sep 17 00:00:00 2001 From: Millian Poquet Date: Fri, 7 Dec 2018 00:33:43 +0100 Subject: [PATCH 2/2] fix generated pkg-config file --- CMakeLists.txt | 4 +++- cmake/redox.pc.in | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54dfa35..3f0fa52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.0.2) project(redox) set(REDOX_VERSION_MAJOR 0) @@ -194,6 +194,8 @@ if (lib) # Install the dynamic library to /usr/lib[64] install(TARGETS redox DESTINATION lib${LIB_SUFFIX}) # Generate the redox.pc pkg-config file in /usr/lib[64]/pkgconfig + get_filename_component(HIREDIS_LIBRARY_DIRECTORY ${HIREDIS_LIBRARIES} DIRECTORY) + get_filename_component(LIBEV_LIBRARY_DIRECTORY ${LIBEV_LIBRARIES} DIRECTORY) configure_file("${CMAKE_HOME_DIRECTORY}/cmake/redox.pc.in" "${PROJECT_BINARY_DIR}/redox.pc" @ONLY) install(FILES "${PROJECT_BINARY_DIR}/redox.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig/) endif() diff --git a/cmake/redox.pc.in b/cmake/redox.pc.in index a480d1f..1574542 100644 --- a/cmake/redox.pc.in +++ b/cmake/redox.pc.in @@ -7,5 +7,5 @@ Name: redox Description: Modern, asynchronous, and wicked fast C++11 client for Redis Version: @REDOX_VERSION_STRING@ -Libs: -L${libdir} -lredox @HIREDIS_LIBRARIES@ @LIBEV_LIBRARIES@ @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} +Libs: -L${libdir} -lredox -L@HIREDIS_LIBRARY_DIRECTORY@ -lhiredis -L@LIBEV_LIBRARY_DIRECTORY@ -lev @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} -I@HIREDIS_INCLUDE_DIRS@