]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: find liboath using the correct name 22430/head
authorKefu Chai <kchai@redhat.com>
Wed, 6 Jun 2018 02:27:38 +0000 (10:27 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 6 Jun 2018 14:49:35 +0000 (22:49 +0800)
we should reference liboath by the $name in Find${name}.cmake, also the
$name should be consistent when calling find_package_handle_standard_args().
in this change
* rename Findliboath.cmake to FindOATH.cmake to be consistent with other
  find_package() moduless.
* use "OATH" in find_package_handle_standard_args() instead of "oath"
* set the interface properties for OATH::OATH, so the target linking
  against it can reference its header directories and libraries automatically.
* remove the stale comment for find_package_handle_standard_args()
* set OATH_INCLUDE_DIRS and OATH_LIBRARIES to follow the convention of
  find_package(), even they are not used directly in this project.

Reported-by: Erwan Velu <erwan@redhat.com>
Signed-off-by: Kefu Chai <kchai@redhat.com>
CMakeLists.txt
cmake/modules/FindOATH.cmake [new file with mode: 0644]
cmake/modules/Findliboath.cmake [deleted file]
src/cls/CMakeLists.txt
src/rgw/CMakeLists.txt

index d557536c20531c47d6838173851e3cb7f1539c9b..3ad7cb4ead1cc3377234d2c622d281162a1fc7a5 100644 (file)
@@ -393,7 +393,7 @@ if(WITH_RADOSGW)
     message(WARNING "disabling WITH_RADOSGW_BEAST_FRONTEND, which depends on WITH_BOOST_CONTEXT")
     set(WITH_RADOSGW_BEAST_FRONTEND OFF)
   endif()
-  find_package(liboath REQUIRED)
+  find_package(OATH REQUIRED)
 
 # https://curl.haxx.se/docs/install.html mentions the
 # configure flags for various ssl backends
diff --git a/cmake/modules/FindOATH.cmake b/cmake/modules/FindOATH.cmake
new file mode 100644 (file)
index 0000000..3ffca40
--- /dev/null
@@ -0,0 +1,32 @@
+# CMake module to search for liboath headers
+#
+# If it's found it sets OATH_FOUND to TRUE
+# and following variables are set:
+# OATH_INCLUDE_DIRS
+# OATH_LIBRARIES
+find_path(OATH_INCLUDE_DIR
+  oath.h
+  PATHS
+  /usr/include
+  /usr/local/include
+  /usr/include/liboath)
+find_library(OATH_LIBRARY NAMES oath liboath PATHS
+  /usr/local/lib
+  /usr/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OATH DEFAULT_MSG OATH_LIBRARY OATH_INCLUDE_DIR)
+
+mark_as_advanced(OATH_LIBRARY OATH_INCLUDE_DIR)
+
+if(OATH_FOUND)
+  set(OATH_INCLUDE_DIRS "${OATH_INCLUDE_DIR}")
+  set(OATH_LIBRARIES "${OATH_LIBRARY}")
+  if(NOT TARGET OATH::OATH)
+    add_library(OATH::OATH UNKNOWN IMPORTED)
+  endif()
+  set_target_properties(OATH::OATH PROPERTIES
+    INTERFACE_INCLUDE_DIRECTORIES "${OATH_INCLUDE_DIRS}"
+    IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+    IMPORTED_LOCATION "${OATH_LIBRARIES}")
+endif()
diff --git a/cmake/modules/Findliboath.cmake b/cmake/modules/Findliboath.cmake
deleted file mode 100644 (file)
index ae5446a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# CMake module to search for liboath headers
-#
-# If it's found it sets LIBOATH_FOUND to TRUE
-# and following variables are set:
-# LIBOATH_INCLUDE_DIR
-# LIBOATH_LIBRARY
-find_path(LIBOATH_INCLUDE_DIR
-  oath.h
-  PATHS
-  /usr/include
-  /usr/local/include
-  /usr/include/liboath)
-find_library(LIBOATH_LIBRARY NAMES oath liboath PATHS
-  /usr/local/lib
-  /usr/lib)
-
-# handle the QUIETLY and REQUIRED arguments and set UUID_FOUND to TRUE if
-# all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(oath DEFAULT_MSG LIBOATH_LIBRARY LIBOATH_INCLUDE_DIR)
-
-mark_as_advanced(LIBOATH_LIBRARY LIBOATH_INCLUDE_DIR)
index f23856cb855a85af39e32b9615abdf509f1e5936..937dc3927f653a62c31c5cc52ebf88c82708b6ef 100644 (file)
@@ -72,7 +72,7 @@ add_library(cls_lock_client STATIC ${cls_lock_client_srcs})
 # cls_otp
 set(cls_otp_srcs otp/cls_otp.cc)
 add_library(cls_otp SHARED ${cls_otp_srcs})
-target_link_libraries(cls_otp oath)
+target_link_libraries(cls_otp OATH::OATH)
 set_target_properties(cls_otp PROPERTIES
   VERSION "1.0.0"
   SOVERSION "1"
index 56a31c6a45c914b1e097b78a10effbfbcb275b28..d982d2700e9732c9a0912b314e43398e2119cef2 100644 (file)
@@ -167,7 +167,7 @@ target_link_libraries(rgw_a librados cls_otp_client cls_lock_client cls_rgw_clie
   ${CURL_LIBRARIES}
   ${EXPAT_LIBRARIES}
   ${OPENLDAP_LIBRARIES} ${CRYPTO_LIBS}
-  oath)
+  OATH::OATH)
 
 if (WITH_RADOSGW_BEAST_FRONTEND)
   target_compile_definitions(rgw_a PUBLIC BOOST_COROUTINES_NO_DEPRECATION_WARNING)