aboutsummaryrefslogtreecommitdiff
path: root/external/CMakeLists.txt
blob: 481fbe9db8d0f56ae4febcecb69b28aff8a5d411 (plain) (blame)
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
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
	include(FindMiniupnpc)
endif()

if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
  message(STATUS "Using shared miniupnpc")
  include_directories(${MINIUPNP_INCLUDE_DIR})
  set(UPNP_LIBRARIES "miniupnpc")
else()
  message(STATUS "Using static miniupnpc from external")
  add_subdirectory(miniupnpc)

  set(UPNPC_BUILD_STATIC ON CACHE BOOL "Build static library")
  set(UPNPC_BUILD_SHARED OFF CACHE BOOL "Build shared library")
  set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables")

  set_property(TARGET upnpc-static PROPERTY FOLDER "external")
  if(MSVC)
    set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
  elseif(NOT MSVC)
    set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
  endif()

  set(UPNP_LIBRARIES "upnpc-static")
endif()