summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2023-04-27 09:48:04 +0900
committerGitHub <noreply@github.com>2023-04-27 08:48:04 +0800
commitfe1f69ab2ec31fb9c9bd17d6fc684b9179c493f6 (patch)
tree35d46c8c5382d2f56965bbf0640a3bc7af1f2efd
parentccfb91e2601385d1e0332e8d75a88f8edf9f5b13 (diff)
downloadthrift-fe1f69ab2ec31fb9c9bd17d6fc684b9179c493f6.tar.gz
THRIFT-5668: Install FindLibevent.cmake (#2726)
Client: cpp ThriftConfig.cmake uses our FindLibevent.cmake but "make install" doesn't install FindLibevent.cmake. It causes an error with find_package(Thrift) like the following: -- Found thrift: /tmp/xxx/tmp/local -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.7") CMake Warning at /usr/share/cmake-3.24/Modules/CMakeFindDependencyMacro.cmake:47 (find_package): By not providing "FindLibevent.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Libevent", but CMake did not find one. Could not find a package configuration file provided by "Libevent" with any of the following names: LibeventConfig.cmake libevent-config.cmake Add the installation prefix of "Libevent" to CMAKE_PREFIX_PATH or set "Libevent_DIR" to a directory containing one of the above files. If "Libevent" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): /tmp/xxx/tmp/local/lib/cmake/thrift/ThriftConfig.cmake:93 (find_dependency)
-rw-r--r--build/cmake/GenerateConfigModule.cmake1
-rw-r--r--build/cmake/ThriftConfig.cmake.in12
2 files changed, 13 insertions, 0 deletions
diff --git a/build/cmake/GenerateConfigModule.cmake b/build/cmake/GenerateConfigModule.cmake
index 9533c8235..26f018a21 100644
--- a/build/cmake/GenerateConfigModule.cmake
+++ b/build/cmake/GenerateConfigModule.cmake
@@ -40,5 +40,6 @@ if (NOT CYGWIN)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ThriftConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/ThriftConfigVersion.cmake"
+ "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/FindLibevent.cmake"
DESTINATION "${CMAKE_INSTALL_DIR}/thrift")
endif()
diff --git a/build/cmake/ThriftConfig.cmake.in b/build/cmake/ThriftConfig.cmake.in
index c05520094..2f2003bb4 100644
--- a/build/cmake/ThriftConfig.cmake.in
+++ b/build/cmake/ThriftConfig.cmake.in
@@ -59,7 +59,19 @@ if(@OPENSSL_FOUND@ AND @WITH_OPENSSL@)
endif()
if(@Libevent_FOUND@ AND @WITH_LIBEVENT@)
+ if(DEFINED CMAKE_MODULE_PATH)
+ set(THRIFT_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
+ else()
+ unset(THRIFT_CMAKE_MODULE_PATH_OLD)
+ endif()
+ set(CMAKE_MODULE_PATH "${THRIFT_CMAKE_DIR}")
find_dependency(Libevent)
+ if(DEFINED THRIFT_CMAKE_MODULE_PATH_OLD)
+ set(CMAKE_MODULE_PATH ${THRIFT_CMAKE_MODULE_PATH_OLD})
+ unset(THRIFT_CMAKE_MODULE_PATH_OLD)
+ else()
+ unset(CMAKE_MODULE_PATH)
+ endif()
endif()
check_required_components(Thrift)