summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTongliang Liao <tolia@microsoft.com>2018-08-12 18:14:49 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-08-12 18:24:10 -0700
commit3cbe8f0c3e326ad61467319b2dc0d79d72d1e13c (patch)
tree891cf3b729a8c94b33bd48285453091e9d23efb9 /modules
parent82d11b847e84c94867b36d4712a232d225fbd8bb (diff)
downloadpytorch-3cbe8f0c3e326ad61467319b2dc0d79d72d1e13c.tar.gz
pytorch-3cbe8f0c3e326ad61467319b2dc0d79d72d1e13c.tar.bz2
pytorch-3cbe8f0c3e326ad61467319b2dc0d79d72d1e13c.zip
Detect system RocksDB installation with CMake config files. (#7315)
Summary: On Windows, the FindRocksDB script doesn't detect rocksdb installation built by cmake. And it doesn't include/link the RocksDB dependencies either, like: * `Snappy` * `Shlwapi.lib` * `Rpcrt4.lib` This PR try to detect in config mode first before using private find module. Pull Request resolved: https://github.com/pytorch/pytorch/pull/7315 Differential Revision: D9287587 Pulled By: Yangqing fbshipit-source-id: 314a36a14bfe04aa45013349c5537163fb4c5c00
Diffstat (limited to 'modules')
-rw-r--r--modules/rocksdb/CMakeLists.txt18
1 files changed, 12 insertions, 6 deletions
diff --git a/modules/rocksdb/CMakeLists.txt b/modules/rocksdb/CMakeLists.txt
index 242423e04f..447d32845c 100644
--- a/modules/rocksdb/CMakeLists.txt
+++ b/modules/rocksdb/CMakeLists.txt
@@ -37,12 +37,18 @@ endif()
# cmake. Note that for modules that are located in the Caffe2 repository,
# cmake related files, such as FindRocksDB in this case, should live in the
# cmake/ folder under root.
-find_package(RocksDB)
-if(NOT ROCKSDB_FOUND)
- message(
- FATAL_ERROR
- "RocksDB not found. If you do not need caffe2_rocksdb, set "
- "-DUSE_ROCKSDB=OFF to solve this error.")
+find_package(RocksDB CONFIG)
+if((DEFINED RocksDB_DIR) AND RocksDB_DIR)
+ list(APPEND RocksDB_LIBRARIES RocksDB::rocksdb)
+else()
+ message("RocksDB config not found. Fallback to legacy find.")
+ find_package(RocksDB)
+ if(NOT ROCKSDB_FOUND)
+ message(
+ FATAL_ERROR
+ "RocksDB not found. If you do not need caffe2_rocksdb, set "
+ "-DUSE_ROCKSDB=OFF to solve this error.")
+ endif()
endif()
# ---[ Third, create the CMake target.