Debian Codegraph @

cmake/FindLibMilter.cmake

raw
1 # Copyright 2022 Timo Röhling <[email protected]>
2 # SPDX-License-Identifier: FSFAP
3 #
4 # Copying and distribution of this file, with or without modification, are
5 # permitted in any medium without royalty provided the copyright notice and
6 # this notice are preserved. This file is offered as-is, without any warranty.
7 #
8 include(FindPackageHandleStandardArgs)
9 find_package(PkgConfig QUIET)
10 if(PkgConfig_FOUND)
11 pkg_search_module(PC_MILTER QUIET milter)
12 endif()
13 find_path(
14 LibMilter_INCLUDE_DIR mfapi.h
15 PATH_SUFFIXES libmilter
16 HINTS ${PC_MILTER_INCLUDE_DIRS}
17 )
18 find_library(LibMilter_LIBRARY milter HINTS ${PC_MILTER_LIBRARY_DIRS})
19 find_package_handle_standard_args(
20 LibMilter
21 FOUND_VAR LibMilter_FOUND
22 REQUIRED_VARS LibMilter_INCLUDE_DIR LibMilter_LIBRARY
23 )
24 if(LibMilter_FOUND AND NOT TARGET LibMilter::LibMilter)
25 add_library(LibMilter::LibMilter UNKNOWN IMPORTED)
26 set_target_properties(
27 LibMilter::LibMilter
28 PROPERTIES IMPORTED_LOCATION "${LibMilter_LIBRARY}"
29 INTERFACE_INCLUDE_DIRECTORIES "${LibMilter_INCLUDE_DIR}"
30 )
31 endif()