FindHUpnp.cmake 1.75 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
# - Try to findHUPNP
# Once done this will define
#
# HUPNP_FOUND           - system has HUPNP
# HUPNP_INCLUDE_DIR - theHUPNP include directory
# HUPNP_LIBRARY         - Link these to use HUPNP
# HUPNP_LIBRARY_DIR  - Library DIR of HUPNP
#

IF (HUPNP_INCLUDE_DIR)
  # Already in cache, be silent
  SET(HUPNP_FIND_QUIETLY TRUE)
ENDIF (HUPNP_INCLUDE_DIR)

FIND_PATH(HUPNP_INCLUDE_DIR
    NAMES "HUpnpCore/HControlPoint"
    PATHS "/usr/include"
          "C:\\libs\\HUpnp\\include")

IF (HUPNP_INCLUDE_DIR )

    FIND_LIBRARY(HUPNP_BASE_LIBRARY 
                  NAMES "HUpnp"
                  PATHS "/usr/lib"
                        "C:\\libs\\HUpnp\\lib"
    )


    FIND_LIBRARY(HUPNP_SOAP_LIBRARY
                  NAMES "QtSolutions_SOAP-2.7"
                  PATHS "/usr/lib"
                        "C:\\libs\\HUpnp\\lib"
    )

    IF(NOT HUPNP_SOAP_LIBRARY)
        #We dont have the actual library file, we try looking for the version shared object library.
        #Use hack mentioned in : http://www.cmake.org/pipermail/cmake/2011-March/043369.html
        #Temporarily add suffix of the library file version
        LIST(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".so.1.0.0")

        FIND_LIBRARY(HUPNP_SOAP_LIBRARY
            NAMES "QtSolutions_SOAP-2.7"
            PATHS "/usr/lib"
                  "C:\\libs\\HUpnp\\lib"
        )

        #Remove suffix after search is completed
        LIST(REMOVE_ITEM CMAKE_FIND_LIBRARY_SUFFIXES ".so.1.0.0")

    ENDIF()

    IF ( HUPNP_SOAP_LIBRARY ) 
      SET(HUPNP_LIBRARY ${HUPNP_BASE_LIBRARY} ${HUPNP_SOAP_LIBRARY} )
      SET(HUPNP_FOUND TRUE)
    ELSE ()
      message (warning "HUPNP_SOAP_LIBRARY not found")
      SET(HUPNP_FOUND FALSE)
    ENDIF()

ELSE (HUPNP_INCLUDE_DIR)
    SET(HUPNP_FOUND FALSE )
ENDIF (HUPNP_INCLUDE_DIR )