diff options
author | Nikhil Marathe <nsm.nikhil@gmail.com> | 2011-03-05 23:16:35 +0530 |
---|---|---|
committer | Nikhil Marathe <nsm.nikhil@gmail.com> | 2011-03-06 12:05:23 +0530 |
commit | 35754c4b9b7395f5c7fb6759801b07007130eeae (patch) | |
tree | 8337e04aada5186b4993b71e1e754d7b85d73fd8 | |
parent | d35f5a88af08aa6658ca5871c58e0332182da30f (diff) | |
download | extra-cmake-modules-35754c4b9b7395f5c7fb6759801b07007130eeae.tar.gz extra-cmake-modules-35754c4b9b7395f5c7fb6759801b07007130eeae.tar.bz2 |
Added HUpnp version reporting and detection.
FindHUpnp.cmake now exposes HUpnp version extracted from HUpnpCore/public/hupnpinfo.h
Solid will require HUpnp v0.9.0
-rw-r--r-- | modules/FindHUpnp.cmake | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/modules/FindHUpnp.cmake b/modules/FindHUpnp.cmake index bbff8335..85c80306 100644 --- a/modules/FindHUpnp.cmake +++ b/modules/FindHUpnp.cmake @@ -4,16 +4,26 @@ # HUPNP_FOUND - system has HUPnP # HUPNP_INCLUDE_DIR - the LIBHUpnp include directory # HUPNP_LIBS - the LIBHUpnp libraries +# HUPNP_VERSION_STRING - The version of HUpnp +# HUPNP_VERSION_MAJOR - The major version of HUpnp +# HUPNP_VERSION_MINOR - The minor version of HUpnp +# HUPNP_VERSION_PATCH - The patch version of HUpnp # # Copyright (c) 2010, Paulo Romulo Alves Barros <paulo.romulo@kdemail.net> -find_path( HUPNP_INCLUDE_DIR - NAMES HUpnp - PATH_SUFFIXES HUpnpCore -) +find_path( HUPNP_INCLUDE_DIR HUpnpCore/HUpnp ) find_library( HUPNP_LIBS HUpnp ) +if( HUPNP_INCLUDE_DIR AND EXISTS "${HUPNP_INCLUDE_DIR}/HUpnpCore/public/hupnpinfo.h" ) + file( STRINGS "${HUPNP_INCLUDE_DIR}/HUpnpCore/public/hupnpinfo.h" HUPNP_INFO_H REGEX "^#define HUPNP_CORE_.*_VERSION .*$" ) + string( REGEX REPLACE ".*HUPNP_CORE_MAJOR_VERSION ([0-9]+).*" "\\1" HUPNP_VERSION_MAJOR "${HUPNP_INFO_H}" ) + string( REGEX REPLACE ".*HUPNP_CORE_MINOR_VERSION ([0-9]+).*" "\\1" HUPNP_VERSION_MINOR "${HUPNP_INFO_H}" ) + string( REGEX REPLACE ".*HUPNP_CORE_PATCH_VERSION ([0-9]+).*" "\\1" HUPNP_VERSION_PATCH "${HUPNP_INFO_H}" ) + + set( HUPNP_VERSION_STRING "${HUPNP_VERSION_MAJOR}.${HUPNP_VERSION_MINOR}.${HUPNP_VERSION_PATCH}" ) +endif() + include( FindPackageHandleStandardArgs ) find_package_handle_standard_args( HUpnp DEFAULT_MSG HUPNP_INCLUDE_DIR HUPNP_LIBS ) |