Add find_dependency()
in cmake config file. (#6791)
Summary: Currently when building PyTorch with latest RocksDB we get errors like "missing target Snappy::snappy", because they are simply not there. With old `${VAR}` approach we essentially hard-code the abs path found during RocksDB build, which is: - Not relocatable. - Doesn't work when changed to modern target-based design because that requires target to present when used for expansion. This fix allows cmake to setup imported target, if enabled during RocksDB build, when downstream uses `find_package(RocksDB)`. This is for https://github.com/facebook/rocksdb/issues/6179 tchaikov Please help review, thanks! Pull Request resolved: https://github.com/facebook/rocksdb/pull/6791 Reviewed By: riversand963 Differential Revision: D21471553 fbshipit-source-id: 8d4ff2ab589a97ca6e6ba27e1f17b97a00f06206
This commit is contained in:
parent
07204837ce
commit
244797aa4b
@ -923,6 +923,8 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS)
|
|||||||
|
|
||||||
install(DIRECTORY include/rocksdb COMPONENT devel DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
install(DIRECTORY include/rocksdb COMPONENT devel DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
|
||||||
|
install(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/modules" COMPONENT devel DESTINATION ${package_config_destination})
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS ${ROCKSDB_STATIC_LIB}
|
TARGETS ${ROCKSDB_STATIC_LIB}
|
||||||
EXPORT RocksDBTargets
|
EXPORT RocksDBTargets
|
||||||
|
@ -1,3 +1,54 @@
|
|||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
|
||||||
|
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
|
set(GFLAGS_USE_TARGET_NAMESPACE @GFLAGS_USE_TARGET_NAMESPACE@)
|
||||||
|
|
||||||
|
if(@WITH_JEMALLOC@)
|
||||||
|
find_dependency(JeMalloc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(@WITH_GFLAGS@)
|
||||||
|
find_dependency(gflags CONFIG)
|
||||||
|
if(NOT gflags_FOUND)
|
||||||
|
find_dependency(gflags)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(@WITH_SNAPPY@)
|
||||||
|
find_dependency(Snappy CONFIG)
|
||||||
|
if(NOT Snappy_FOUND)
|
||||||
|
find_dependency(Snappy)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(@WITH_ZLIB@)
|
||||||
|
find_dependency(ZLIB)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(@WITH_BZ2@)
|
||||||
|
find_dependency(BZip2)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(@WITH_LZ4@)
|
||||||
|
find_dependency(lz4)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(@WITH_ZSTD@)
|
||||||
|
find_dependency(zstd)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(@WITH_NUMA@)
|
||||||
|
find_dependency(NUMA)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(@WITH_TBB@)
|
||||||
|
find_dependency(TBB)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_dependency(Threads)
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/RocksDBTargets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/RocksDBTargets.cmake")
|
||||||
check_required_components(RocksDB)
|
check_required_components(RocksDB)
|
||||||
|
Loading…
Reference in New Issue
Block a user