]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake and build: add netlink lib requirement detection
authorMike Christie <mchristi@redhat.com>
Wed, 5 Jun 2019 04:42:40 +0000 (23:42 -0500)
committerMike Christie <mchristi@redhat.com>
Wed, 5 Jun 2019 04:56:53 +0000 (23:56 -0500)
The next patch adds netlink support to rbd-nbd. This patch just adds the
build related changes to bring in the netlink lib and test and build
against it.

Signed-off-by: Mike Christie <mchristi@redhat.com>
CMakeLists.txt
ceph.spec.in
cmake/modules/Findgenl.cmake [new file with mode: 0644]
debian/control
src/tools/rbd_nbd/CMakeLists.txt

index 7a95e82009c4dcc7655c724f0b696d60040c0cd5..050dfe059b40bba6f0c2552c75033281bb3b601e 100644 (file)
@@ -218,15 +218,22 @@ if(LINUX)
   set(HAVE_UDEV ${UDEV_FOUND})
   find_package(blkid REQUIRED)
   set(HAVE_BLKID ${BLKID_FOUND})
+  if(WITH_RBD)
+    find_package(genl REQUIRED)
+    set(HAVE_GENL $GENL_FOUND)
+  endif()
 elseif(FREEBSD)
   set(HAVE_UDEV OFF)
   set(HAVE_LIBAIO OFF)
   set(HAVE_BLKID OFF)
+  set(HAVE_GENL OFF)
 else()
   set(HAVE_UDEV OFF)
   message(STATUS "Not using udev")
   set(HAVE_BLKID OFF)
   message(STATUS "Not using BLKID")
+  set(HAVE_GENL OFF)
+  message(STATUS "Not using GENL")
 endif(LINUX)
 
 option(WITH_OPENLDAP "OPENLDAP is here" ON)
index 708d81fd6767ead1c076cd58e8f3952fdccace03..c5d484d721c8cb7d0a7f446f91c666d1f48a9b0e 100644 (file)
@@ -169,6 +169,7 @@ BuildRequires:      libaio-devel
 BuildRequires: libblkid-devel >= 2.17
 BuildRequires: libcurl-devel
 BuildRequires: libudev-devel
+BuildRequires: libnl3-devel
 BuildRequires: liboath-devel
 BuildRequires: libtool
 BuildRequires: libxml2-devel
diff --git a/cmake/modules/Findgenl.cmake b/cmake/modules/Findgenl.cmake
new file mode 100644 (file)
index 0000000..07c5f35
--- /dev/null
@@ -0,0 +1,23 @@
+# - Find libnl-genl3
+# Find the genl library and includes
+#
+# GENL_INCLUDE_DIR - where to find netlink.h, etc.
+# GENL_LIBRARIES - List of libraries when using genl.
+# GENL_FOUND - True if genl found.
+
+find_path(GENL_INCLUDE_DIR NAMES netlink/netlink.h PATH_SUFFIXES libnl3)
+
+find_library(LIBNL_LIB nl-3)
+find_library(LIBNL_GENL_LIB nl-genl-3)
+set(GENL_LIBRARIES
+  ${LIBNL_LIB}
+  ${LIBNL_GENL_LIB}
+  )
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(nl-genl-3
+  DEFAULT_MSG GENL_LIBRARIES GENL_INCLUDE_DIR)
+
+mark_as_advanced(
+  GENL_LIBRARIES
+  GENL_INCLUDE_DIR)
index 2bb5e6fbb90e726840cd6448222ebaac400d62a9..de2a88565fa97a6da4d9154264d9ba77fdd4f00a 100644 (file)
@@ -45,6 +45,8 @@ Build-Depends: cmake (>= 3.5),
                libssl-dev,
                libtool,
                libudev-dev,
+               libnl-3-dev,
+               libnl-genl-3-dev,
                libxml2-dev,
                librabbitmq-dev,
                lsb-release,
index d7ce811e9634f7b19952428a87595c90fd1c02ff..5356fae4f9bdc51241c4d55a56932d4a6589158b 100644 (file)
@@ -1,3 +1,4 @@
 add_executable(rbd-nbd rbd-nbd.cc)
-target_link_libraries(rbd-nbd librbd librados global)
+target_include_directories(rbd-nbd PUBLIC ${GENL_INCLUDE_DIR})
+target_link_libraries(rbd-nbd librbd librados global ${GENL_LIBRARIES})
 install(TARGETS rbd-nbd DESTINATION bin)