]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: to get the header and library from specified path
authorXiubo Li <xiubli@redhat.com>
Fri, 8 May 2020 12:36:15 +0000 (08:36 -0400)
committerXiubo Li <xiubli@redhat.com>
Mon, 25 May 2020 01:40:18 +0000 (21:40 -0400)
Since the pkg_search_module will help us set the header and lib
path, which we should get the headers and lib from. To check from
other paths will make no sense.

Fixes: https://tracker.ceph.com/issues/45396
Signed-off-by: Xiubo Li <xiubli@redhat.com>
cmake/modules/FindFUSE.cmake

index db489bdc1ad6a6346f83307f6b879a284a7c88fb..b55a2d36f508939c054fac294b3a00713e16e9cf 100644 (file)
@@ -19,15 +19,6 @@ if(APPLE)
   list(APPEND fuse_suffixes osxfuse)
 endif()
 
-find_path(
-  FUSE_INCLUDE_DIR
-  NAMES fuse_common.h fuse_lowlevel.h fuse.h
-  PATH_SUFFIXES ${fuse_suffixes})
-
-find_library(FUSE_LIBRARIES
-  NAMES ${fuse_names}
-  PATHS /usr/local/lib64 /usr/local/lib)
-
 find_package(PkgConfig QUIET)
 if(PKG_CONFIG_FOUND)
   pkg_search_module(PKG_FUSE QUIET ${fuse_names})
@@ -36,7 +27,28 @@ if(PKG_CONFIG_FOUND)
     "\\1" FUSE_MAJOR_VERSION "${PKG_FUSE_VERSION}")
   string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)"
     "\\2" FUSE_MINOR_VERSION "${PKG_FUSE_VERSION}")
+
+  find_path(
+    FUSE_INCLUDE_DIR
+    NAMES fuse_common.h fuse_lowlevel.h fuse.h
+    HINTS ${PKG_FUSE_INCLUDE_DIRS}
+    PATH_SUFFIXES ${fuse_suffixes}
+    NO_DEFAULT_PATH)
+
+  find_library(FUSE_LIBRARIES
+    NAMES ${fuse_names}
+    HINTS ${PKG_FUSE_LIBDIR}
+    NO_DEFAULT_PATH)
 else()
+  find_path(
+    FUSE_INCLUDE_DIR
+    NAMES fuse_common.h fuse_lowlevel.h fuse.h
+    PATH_SUFFIXES ${fuse_suffixes})
+
+  find_library(FUSE_LIBRARIES
+    NAMES ${fuse_names}
+    PATHS /usr/local/lib64 /usr/local/lib)
+
   foreach(ver "MAJOR" "MINOR")
     file(STRINGS "${FUSE_INCLUDE_DIR}/fuse_common.h" fuse_ver_${ver}_line
       REGEX "^#define[\t ]+FUSE_${ver}_VERSION[\t ]+[0-9]+$")