summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2021-04-19 06:24:34 +0000
committerAlan Antonuk <alan.antonuk@gmail.com>2021-04-19 00:16:12 -0700
commitc788038ba584520154e2b0d1668aba6e2bc9a90e (patch)
treef15256f6ff7731ca679fc54e80f0a60e0d554947 /cmake
parentf2e8abb582ca2d7bb4fdd15157b058305daeb35d (diff)
downloadrabbitmq-c-c788038ba584520154e2b0d1668aba6e2bc9a90e.tar.gz
Make FindPOPT.cmake import cmake targets
Signed-off-by: GitHub <noreply@github.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindPOPT.cmake45
1 files changed, 27 insertions, 18 deletions
diff --git a/cmake/FindPOPT.cmake b/cmake/FindPOPT.cmake
index 79caa01..e315f72 100644
--- a/cmake/FindPOPT.cmake
+++ b/cmake/FindPOPT.cmake
@@ -11,29 +11,38 @@
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(PC_POPT QUIET popt)
-endif ()
+endif()
# Find the include directories
-FIND_PATH(POPT_INCLUDE_DIR
- NAMES popt.h
- HINTS
- ${PC_POPT_INCLUDEDIR}
- ${PC_POPT_INCLUDE_DIRS}
- DOC "Path containing the popt.h include file"
- )
-
-FIND_LIBRARY(POPT_LIBRARY
- NAMES popt
- HINTS
- ${PC_POPT_LIBRARYDIR}
- ${PC_POPT_LIBRARY_DIRS}
- DOC "popt library path"
- )
+find_path(POPT_INCLUDE_DIR
+ NAMES popt.h
+ HINTS
+ ${PC_POPT_INCLUDEDIR}
+ ${PC_POPT_INCLUDE_DIRS}
+ DOC "Path containing the popt.h include file"
+ )
+
+find_library(POPT_LIBRARY
+ NAMES popt
+ HINTS
+ ${PC_POPT_LIBRARYDIR}
+ ${PC_POPT_LIBRARY_DIRS}
+ DOC "popt library path"
+ )
include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(POPT
+find_package_handle_standard_args(POPT
REQUIRED_VARS POPT_INCLUDE_DIR POPT_LIBRARY
VERSION_VAR PC_POPT_VERSION)
-MARK_AS_ADVANCED(POPT_INCLUDE_DIR POPT_LIBRARY)
+mark_as_advanced(POPT_INCLUDE_DIR POPT_LIBRARY)
+
+if(POPT_FOUND AND NOT TARGET popt::popt)
+ add_library(popt::popt UNKNOWN IMPORTED)
+ set_target_properties(popt::popt PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${POPT_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${POPT_INCLUDE_DIR}"
+ )
+endif()