summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorTongliang Liao <xkszltl@gmail.com>2021-10-06 01:08:28 +0800
committerMichael Grunder <michael.grunder@gmail.com>2022-09-01 10:43:36 -0700
commit35d398c903021f9d6827c06e1b9c799b6dad4d07 (patch)
tree6074ee811688b5696098122df074fb0a49a3b8ca /CMakeLists.txt
parent10c78c6e179a32b3e1f9cd99bf18dcf0c37d295e (diff)
Fix cmake config path on Linux.
CMake config files were installed to `/usr/local/share/hiredis`, which is not recognizable by `find_package()`. I'm not sure why it was set that way. Given the commit introducing it is for Windows, I keep that behavior consistent there, but fix the rest.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7190b0e..ee03add 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -135,7 +135,11 @@ export(EXPORT hiredis-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/hiredis-targets.cmake"
NAMESPACE hiredis::)
-SET(CMAKE_CONF_INSTALL_DIR share/hiredis)
+if(WIN32)
+ SET(CMAKE_CONF_INSTALL_DIR share/hiredis)
+else()
+ SET(CMAKE_CONF_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/hiredis)
+endif()
SET(INCLUDE_INSTALL_DIR include)
include(CMakePackageConfigHelpers)
configure_package_config_file(hiredis-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/hiredis-config.cmake
@@ -217,7 +221,11 @@ IF(ENABLE_SSL)
FILE "${CMAKE_CURRENT_BINARY_DIR}/hiredis_ssl-targets.cmake"
NAMESPACE hiredis::)
- SET(CMAKE_CONF_INSTALL_DIR share/hiredis_ssl)
+ if(WIN32)
+ SET(CMAKE_CONF_INSTALL_DIR share/hiredis_ssl)
+ else()
+ SET(CMAKE_CONF_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/hiredis_ssl)
+ endif()
configure_package_config_file(hiredis_ssl-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/hiredis_ssl-config.cmake
INSTALL_DESTINATION ${CMAKE_CONF_INSTALL_DIR}
PATH_VARS INCLUDE_INSTALL_DIR)