|
11 | 11 | find_package(PkgConfig QUIET) |
12 | 12 | if (PKG_CONFIG_FOUND) |
13 | 13 | pkg_search_module(PC_POPT QUIET popt) |
14 | | -endif () |
| 14 | +endif() |
15 | 15 |
|
16 | 16 | # Find the include directories |
17 | | -FIND_PATH(POPT_INCLUDE_DIR |
18 | | - NAMES popt.h |
19 | | - HINTS |
20 | | - ${PC_POPT_INCLUDEDIR} |
21 | | - ${PC_POPT_INCLUDE_DIRS} |
22 | | - DOC "Path containing the popt.h include file" |
23 | | - ) |
24 | | - |
25 | | -FIND_LIBRARY(POPT_LIBRARY |
26 | | - NAMES popt |
27 | | - HINTS |
28 | | - ${PC_POPT_LIBRARYDIR} |
29 | | - ${PC_POPT_LIBRARY_DIRS} |
30 | | - DOC "popt library path" |
31 | | - ) |
| 17 | +find_path(POPT_INCLUDE_DIR |
| 18 | + NAMES popt.h |
| 19 | + HINTS |
| 20 | + ${PC_POPT_INCLUDEDIR} |
| 21 | + ${PC_POPT_INCLUDE_DIRS} |
| 22 | + DOC "Path containing the popt.h include file" |
| 23 | + ) |
| 24 | + |
| 25 | +find_library(POPT_LIBRARY |
| 26 | + NAMES popt |
| 27 | + HINTS |
| 28 | + ${PC_POPT_LIBRARYDIR} |
| 29 | + ${PC_POPT_LIBRARY_DIRS} |
| 30 | + DOC "popt library path" |
| 31 | + ) |
32 | 32 |
|
33 | 33 | include(FindPackageHandleStandardArgs) |
34 | 34 |
|
35 | | -FIND_PACKAGE_HANDLE_STANDARD_ARGS(POPT |
| 35 | +find_package_handle_standard_args(POPT |
36 | 36 | REQUIRED_VARS POPT_INCLUDE_DIR POPT_LIBRARY |
37 | 37 | VERSION_VAR PC_POPT_VERSION) |
38 | 38 |
|
39 | | -MARK_AS_ADVANCED(POPT_INCLUDE_DIR POPT_LIBRARY) |
| 39 | +mark_as_advanced(POPT_INCLUDE_DIR POPT_LIBRARY) |
| 40 | + |
| 41 | +if(POPT_FOUND AND NOT TARGET popt::popt) |
| 42 | + add_library(popt::popt UNKNOWN IMPORTED) |
| 43 | + set_target_properties(popt::popt PROPERTIES |
| 44 | + IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
| 45 | + IMPORTED_LOCATION "${POPT_LIBRARY}" |
| 46 | + INTERFACE_INCLUDE_DIRECTORIES "${POPT_INCLUDE_DIR}" |
| 47 | + ) |
| 48 | +endif() |
0 commit comments