diff options
author | Kefu Chai <kchai@redhat.com> | 2018-06-06 04:27:38 +0200 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2018-06-06 16:49:35 +0200 |
commit | ca78ab2254d10ba9da7b0d760ed2b1cd6577c0bb (patch) | |
tree | 9b9e2b6a2851ab6304ee7ad60c34487df2317688 /cmake | |
parent | Merge pull request #21644 from p-na/grafana-proxy (diff) | |
download | ceph-ca78ab2254d10ba9da7b0d760ed2b1cd6577c0bb.tar.xz ceph-ca78ab2254d10ba9da7b0d760ed2b1cd6577c0bb.zip |
cmake: find liboath using the correct name
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>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/FindOATH.cmake | 32 | ||||
-rw-r--r-- | cmake/modules/Findliboath.cmake | 22 |
2 files changed, 32 insertions, 22 deletions
diff --git a/cmake/modules/FindOATH.cmake b/cmake/modules/FindOATH.cmake new file mode 100644 index 00000000000..3ffca40f203 --- /dev/null +++ b/cmake/modules/FindOATH.cmake @@ -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 index ae5446a8ee9..00000000000 --- a/cmake/modules/Findliboath.cmake +++ /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) |