2015-10-12 00:26:35 +00:00
|
|
|
# This file only works for MiniUPnPc 1.7 or later (it requires MINIUPNPC_API_VERSION).
|
|
|
|
# TODO Find out if any distribution still ships with /usr/include/miniupnpc.h (i.e. not in a separate directory).
|
2013-07-10 03:07:27 +00:00
|
|
|
|
2015-10-12 00:26:35 +00:00
|
|
|
find_path(MINIUPNPC_INCLUDE_DIR miniupnpc.h PATH_SUFFIXES miniupnpc)
|
|
|
|
find_library(MINIUPNPC_LIBRARY miniupnpc)
|
2013-07-10 03:07:27 +00:00
|
|
|
|
2015-10-12 00:26:35 +00:00
|
|
|
if(MINIUPNPC_INCLUDE_DIR)
|
2023-04-16 05:57:34 +00:00
|
|
|
file(STRINGS "${MINIUPNPC_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_VERSION[\t ]+.*")
|
|
|
|
if(MINIUPNPC_VERSION_STR)
|
|
|
|
string(REGEX REPLACE "^#define[\t ]+MINIUPNPC_VERSION[\t ]+\"([.0-9]+)\"" "\\1" MINIUPNPC_VERSION ${MINIUPNPC_VERSION_STR})
|
2015-11-02 05:00:06 +00:00
|
|
|
endif()
|
2015-10-12 00:26:35 +00:00
|
|
|
endif()
|
2013-07-10 03:07:27 +00:00
|
|
|
|
2015-10-12 00:26:35 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2023-04-16 05:57:34 +00:00
|
|
|
find_package_handle_standard_args(MINIUPNPC
|
|
|
|
REQUIRED_VARS MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY
|
|
|
|
VERSION_VAR MINIUPNPC_VERSION
|
|
|
|
)
|
2013-07-10 03:07:27 +00:00
|
|
|
|
2015-10-12 00:26:35 +00:00
|
|
|
set(MINIUPNPC_LIBRARIES ${MINIUPNPC_LIBRARY})
|
|
|
|
set(MINIUPNPC_INCLUDE_DIRS ${MINIUPNPC_INCLUDE_DIR})
|
|
|
|
mark_as_advanced(MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY MINIUPNPC_API_VERSION_STR)
|
2017-08-14 22:12:28 +00:00
|
|
|
|
|
|
|
if (MINIUPNPC_FOUND AND NOT TARGET miniupnpc)
|
|
|
|
add_library(Miniupnpc::miniupnpc UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(Miniupnpc::miniupnpc PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${MINIUPNPC_LIBRARIES}
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${MINIUPNPC_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
endif()
|