FindMiniupnpc.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Find miniupnpc
  2. #
  3. # Find the miniupnpc includes and library
  4. #
  5. # if you nee to add a custom library search path, do it via CMAKE_PREFIX_PATH
  6. #
  7. # This module defines
  8. # MINIUPNPC_INCLUDE_DIRS, where to find header, etc.
  9. # MINIUPNPC_LIBRARIES, the libraries needed to use miniupnpc.
  10. # MINIUPNPC_FOUND, If false, do not try to use miniupnpc.
  11. # only look in default directories
  12. find_path(
  13. MINIUPNPC_INCLUDE_DIR
  14. NAMES miniupnpc/miniupnpc.h
  15. DOC "miniupnpc include dir"
  16. )
  17. find_library(
  18. MINIUPNPC_LIBRARY
  19. NAMES miniupnpc
  20. DOC "miniupnpc library"
  21. )
  22. set(MINIUPNPC_INCLUDE_DIRS ${MINIUPNPC_INCLUDE_DIR})
  23. set(MINIUPNPC_LIBRARIES ${MINIUPNPC_LIBRARY})
  24. # debug library on windows
  25. # same naming convention as in QT (appending debug library with d)
  26. # boost is using the same "hack" as us with "optimized" and "debug"
  27. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
  28. find_library(
  29. MINIUPNPC_LIBRARY_DEBUG
  30. NAMES miniupnpcd
  31. DOC "miniupnpc debug library"
  32. )
  33. set(MINIUPNPC_LIBRARIES "iphlpapi" optimized ${MINIUPNPC_LIBRARIES} debug ${MINIUPNPC_LIBRARY_DEBUG})
  34. endif()
  35. # handle the QUIETLY and REQUIRED arguments and set MINIUPNPC_FOUND to TRUE
  36. # if all listed variables are TRUE, hide their existence from configuration view
  37. include(FindPackageHandleStandardArgs)
  38. find_package_handle_standard_args(miniupnpc DEFAULT_MSG
  39. MINIUPNPC_LIBRARY MINIUPNPC_INCLUDE_DIR)
  40. mark_as_advanced (MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY)