diff options
author | Alan Antonuk <alan.antonuk@gmail.com> | 2012-11-13 19:11:59 -0500 |
---|---|---|
committer | Alan Antonuk <alan.antonuk@gmail.com> | 2012-11-14 23:02:06 -0500 |
commit | ef87ad4de86de4ad0cf911581cfabfe97f841b93 (patch) | |
tree | a77ab10b0cdabceef2e90de0044c2123f1727fd5 /cmake | |
parent | e9e054f819cd037663a1e144f947bc5826bc3704 (diff) | |
download | rabbitmq-c-github-ask-ef87ad4de86de4ad0cf911581cfabfe97f841b93.tar.gz |
Refactor FindPOPT.cmake script
Refactor FindPOPT to:
- Use pkg-config when available. (popt installs with a pkg-config file)
- Use FindPackageHandleStandardArgs which is a default part of CMake
and thus we don't need to maintain LibFindMacros
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindPOPT.cmake | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/cmake/FindPOPT.cmake b/cmake/FindPOPT.cmake index e0af678..ac11358 100644 --- a/cmake/FindPOPT.cmake +++ b/cmake/FindPOPT.cmake @@ -1,18 +1,37 @@ -INCLUDE(LibFindMacros) +# - Try to find the popt options processing library +# The module will set the following variables +# +# POPT_FOUND - System has popt +# POPT_INCLUDE_DIR - The popt include directory +# POPT_LIBRARIES - The libraries needed to use popt + +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls + +find_package(PkgConfig QUIET) +pkg_search_module(PC_POPT QUIET popt) # Find the include directories FIND_PATH(POPT_INCLUDE_DIR NAMES popt.h - HINTS ${POPT_PREFIX}/include + HINTS + ${PC_POPT_INCLUDEDIR} + ${PC_POPT_INCLUDE_DIRS} + DOC "Path containing the popt.h include file" ) FIND_LIBRARY(POPT_LIBRARY NAMES popt - HINTS ${POPT_PREFIX}/lib + HINTS + ${PC_POPT_LIBRARYDIR} + ${PC_POPT_LIBRARY_DIRS} + DOC "popt library path" ) -SET(POPT_PROCESS_INCLUDES POPT_INCLUDE_DIR) -SET(POPT_PROCESS_LIBS POPT_LIBRARY) +include(FindPackageHandleStandardArgs) -LIBFIND_PROCESS(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) |