]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: improve build inst for cephsqlite
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 23 Jul 2019 21:43:50 +0000 (14:43 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 22 Mar 2021 17:14:00 +0000 (10:14 -0700)
Notably, find SQLite and build the test code.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit eb52c869d5a3672a85b9dec25b9e372e57239bcf)

CMakeLists.txt
cmake/modules/FindSQLite3.cmake [new file with mode: 0644]
src/CMakeLists.txt
src/test/CMakeLists.txt

index 9b66ddd636ee2ac5a29285629175710ce5cbbb2e..7734ad08b9cd163d77d19f80c0e615c9dbfcaeb8 100644 (file)
@@ -278,7 +278,14 @@ endif(WITH_QATZIP)
 
 # needs mds and? XXX
 option(WITH_LIBCEPHFS "libcephfs client library" ON)
-option(WITH_LIBCEPHSQLITE "libcephsqlite client library" ON)
+
+find_package(SQLite3)
+if(SQLITE3_FOUND)
+  option(WITH_LIBCEPHSQLITE "libcephsqlite client library" ON)
+else()
+  message(WARNING "disabling WITH_LIBCEPHSQLITE, which depends on SQLite3")
+  set(WITH_LIBCEPHSQLITE OFF)
+endif()
 
 # key-value store
 option(WITH_KVS "Key value store is here" ON)
diff --git a/cmake/modules/FindSQLite3.cmake b/cmake/modules/FindSQLite3.cmake
new file mode 100644 (file)
index 0000000..3d96d66
--- /dev/null
@@ -0,0 +1,10 @@
+find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h PATHS /usr/include /usr/local/include)
+find_library(SQLITE3_LIBRARY NAMES sqlite3)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SQLITE3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR)
+
+if(SQLITE3_FOUND)
+  set(SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
+  set(SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
+endif()
index 5a6c1e2e42e51e30856d838b1aeab774b7864ef3..67b4fab6fa3a9682f642771e7925c683776314ad 100644 (file)
@@ -803,8 +803,8 @@ endif(WITH_LIBCEPHFS)
 if(WITH_LIBCEPHSQLITE)
   set(libcephsqlite_srcs libcephsqlite.cc)
   add_library(cephsqlite ${CEPH_SHARED} ${libcephsqlite_srcs})
-  target_link_libraries(cephsqlite PRIVATE client ceph-common
-    ${CRYPTO_LIBS} ${EXTRALIBS})
+  set_target_properties(cephsqlite PROPERTIES COMPILE_FLAGS "-I${SQLITE3_INCLUDE_DIRS}")
+  target_link_libraries(cephsqlite radosstriper librados ${SQLITE3_LIBRARIES} ${EXTRALIBS})
   if(ENABLE_SHARED)
     set_target_properties(cephsqlite PROPERTIES
       OUTPUT_NAME cephsqlite
index d9075df4c60c0c6acec1e9c4e8b100d6a2773df4..c0cf6454a45da58f3afdddce6d03ba7428ef7051 100644 (file)
@@ -939,4 +939,9 @@ add_ceph_unittest(unittest_any)
 add_executable(unittest_weighted_shuffle test_weighted_shuffle.cc)
 add_ceph_unittest(unittest_weighted_shuffle)
 
+if(WITH_LIBCEPHSQLITE)
+  add_executable(test_libcephsqlite test_libcephsqlite.cc)
+  target_link_libraries(test_libcephsqlite cephsqlite radosstriper librados)
+endif(WITH_LIBCEPHSQLITE)
+
 #make check ends here