| 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_CONFUSE QUIET libconfuse) |
| 12 |
endif() |
| 13 |
find_path(Confuse_INCLUDE_DIR confuse.h HINTS ${PC_CONFUSE_INCLUDE_DIRS}) |
| 14 |
find_library(Confuse_LIBRARY confuse HINTS ${PC_CONFUSE_LIBRARY_DIRS}) |
| 15 |
find_package_handle_standard_args( |
| 16 |
Confuse |
| 17 |
FOUND_VAR Confuse_FOUND |
| 18 |
REQUIRED_VARS Confuse_INCLUDE_DIR Confuse_LIBRARY |
| 19 |
) |
| 20 |
if(Confuse_FOUND AND NOT TARGET Confuse::Confuse) |
| 21 |
add_library(Confuse::Confuse UNKNOWN IMPORTED) |
| 22 |
set_target_properties( |
| 23 |
Confuse::Confuse |
| 24 |
PROPERTIES IMPORTED_LOCATION "${Confuse_LIBRARY}" |
| 25 |
INTERFACE_INCLUDE_DIRECTORIES "${Confuse_INCLUDE_DIR}" |
| 26 |
) |
| 27 |
endif() |