Warning, /frameworks/extra-cmake-modules/find-modules/FindLibMount.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2021 Ahmad Samir <a.samirh78@gmail.com> 0002 # 0003 # SPDX-License-Identifier: BSD-3-Clause 0004 0005 #[=======================================================================[.rst: 0006 0007 FindLibMount 0008 ------------ 0009 0010 Try to find the libmount library (part of util-linux), once done this will define: 0011 0012 ``LibMount_FOUND`` 0013 LibMount was found on the system. 0014 0015 ``LibMount_INCLUDE_DIRS`` 0016 The libmount include directory. 0017 0018 ``LibMount_LIBRARIES`` 0019 The libmount libraries. 0020 0021 ``LibMount_VERSION`` 0022 The libmount version. 0023 0024 If ``LibMount_FOUND`` is TRUE, it will also define the following imported target: 0025 0026 ``LibMount::LibMount`` 0027 The libmount library 0028 0029 Since 5.83.0 0030 #]=======================================================================] 0031 0032 find_package(PkgConfig QUIET) 0033 pkg_check_modules(PC_LIBMOUNT QUIET IMPORTED_TARGET mount) 0034 0035 find_path(LibMount_INCLUDE_DIRS NAMES libmount/libmount.h HINTS ${PC_LIBMOUNT_INCLUDE_DIRS}) 0036 find_library(LibMount_LIBRARIES NAMES mount HINTS ${PC_LIBMOUNT_LIBRARY_DIRS}) 0037 0038 set(LibMount_VERSION ${PC_LIBMOUNT_VERSION}) 0039 0040 if(LibMount_INCLUDE_DIRS AND NOT LibMount_VERSION) 0041 file(READ "${LibMount_INCLUDE_DIRS}/libmount/libmount.h" _LibMount_header_contents) 0042 string(REGEX MATCHALL "#define[ \t]+LIBMOUNT_VERSION[ \t]+\"*[0-9.]+" _LibMount_version_line "${_LibMount_header_contents}") 0043 unset(_LibMount_header_contents) 0044 string(REGEX REPLACE ".*LIBMOUNT_VERSION[ \t]+\"*([0-9.]+)\"*" "\\1" _version "${_LibMount_version_line}") 0045 set(LibMount_VERSION "${_version}") 0046 unset(_LibMount_version_line) 0047 endif() 0048 0049 include(FindPackageHandleStandardArgs) 0050 find_package_handle_standard_args(LibMount 0051 FOUND_VAR LibMount_FOUND 0052 REQUIRED_VARS LibMount_INCLUDE_DIRS LibMount_LIBRARIES 0053 VERSION_VAR LibMount_VERSION 0054 ) 0055 0056 mark_as_advanced(LibMount_INCLUDE_DIRS LibMount_LIBRARIES) 0057 0058 if(LibMount_FOUND AND NOT TARGET LibMount::LibMount) 0059 add_library(LibMount::LibMount UNKNOWN IMPORTED) 0060 set_target_properties(LibMount::LibMount PROPERTIES 0061 IMPORTED_LOCATION "${LibMount_LIBRARIES}" 0062 INTERFACE_INCLUDE_DIRECTORIES "${LibMount_INCLUDE_DIRS}" 0063 INTERFACE_COMPILE_DEFINITIONS "${PC_LIBMOUNT_CFLAGS_OTHER}" 0064 ) 0065 if (TARGET PkgConfig::PC_LIBMOUNT) 0066 target_link_libraries(LibMount::LibMount INTERFACE PkgConfig::PC_LIBMOUNT) 0067 endif() 0068 endif() 0069 0070 include(FeatureSummary) 0071 set_package_properties(LibMount PROPERTIES 0072 DESCRIPTION "API for getting info about mounted filesystems (part of util-linux)" 0073 URL "https://www.kernel.org/pub/linux/utils/util-linux/" 0074 )