From 35d398c903021f9d6827c06e1b9c799b6dad4d07 Mon Sep 17 00:00:00 2001 From: Tongliang Liao Date: Wed, 6 Oct 2021 01:08:28 +0800 Subject: [PATCH] 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. --- CMakeLists.txt | 12 ++++++++++-- 1 file 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)