diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /cmake/modules/Findmotr.cmake | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/Findmotr.cmake')
-rw-r--r-- | cmake/modules/Findmotr.cmake | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cmake/modules/Findmotr.cmake b/cmake/modules/Findmotr.cmake new file mode 100644 index 000000000..5ac0ef697 --- /dev/null +++ b/cmake/modules/Findmotr.cmake @@ -0,0 +1,50 @@ +# - Find libmotr +# Find the motr and motrhl libraries and includes +# +# motr_INCLUDE_DIR - where to find motr.hpp etc. +# motr_LIBRARIES - List of libraries when using motr. +# motr_FOUND - True if motr found. + +find_package(PkgConfig QUIET REQUIRED) +pkg_search_module(PC_motr QUIET motr) + +find_path(motr_INCLUDE_DIR + NAMES motr/config.h + HINTS ${PC_motr_INCLUDE_DIRS}) +find_library(motr_LIBRARY + NAMES motr + HINTS ${PC_motr_LIBRARY_DIRS}) +find_library(motr_helpers_LIBRARY + NAMES motr-helpers + HINTS ${PC_motr_LIBRARY_DIRS}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(motr + DEFAULT_MSG + motr_INCLUDE_DIR + motr_LIBRARY + motr_helpers_LIBRARY) + +mark_as_advanced( + motr_INCLUDE_DIR + motr_LIBRARY + motr_helpers_LIBRARY) + +if(motr_FOUND) + set(motr_LIBRARIES ${motr_LIBRARY} ${motr_helpers_LIBRARY}) + if(NOT (TARGET motr::helpers)) + add_library(motr::helpers UNKNOWN IMPORTED) + set_target_properties(motr::helpers PROPERTIES + IMPORTED_LOCATION "${motr_helpers_LIBRARY}") + endif() + if(NOT (TARGET motr::motr)) + add_library(motr::motr UNKNOWN IMPORTED) + set_target_properties(motr::motr PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "M0_EXTERN=extern;M0_INTERNAL=" + INTERFACE_COMPILE_OPTIONS "-Wno-attributes" + INTERFACE_INCLUDE_DIRECTORIES "${motr_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES motr::helpers + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${motr_LIBRARY}") + endif() +endif() |