2016-08-24 22:47:22 +00:00
|
|
|
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
|
|
|
project(keepupnpup CXX)
|
|
|
|
|
2016-08-25 21:57:17 +00:00
|
|
|
option (USE_SYSTEM_MINIUPNP "Try to locate miniupnpc on the system and build against that" ON)
|
|
|
|
|
|
|
|
if (USE_SYSTEM_MINIUPNP)
|
|
|
|
find_package(Miniupnpc 2.0 REQUIRED)
|
2016-08-24 22:47:22 +00:00
|
|
|
else()
|
2016-08-25 21:57:17 +00:00
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
set(upnp_lib_type "shared")
|
|
|
|
set(UPNPC_BUILD_STATIC OFF CACHE BOOL "" FORCE)
|
|
|
|
set(UPNPC_BUILD_SHARED ON CACHE BOOL "" FORCE)
|
|
|
|
else()
|
|
|
|
set(upnp_lib_type "static")
|
|
|
|
set(UPNPC_BUILD_STATIC ON CACHE BOOL "" FORCE)
|
|
|
|
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "" FORCE)
|
|
|
|
endif()
|
|
|
|
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
|
|
set(CXX_STANDARD_REQUIRED ON)
|
2016-08-24 22:47:22 +00:00
|
|
|
|
2016-08-25 21:57:17 +00:00
|
|
|
add_subdirectory(lib/miniupnp/miniupnpc)
|
|
|
|
endif()
|
2016-08-24 22:47:22 +00:00
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
|
|
src/main.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
2016-08-25 01:15:37 +00:00
|
|
|
PRIVATE lib/better-enums
|
2016-08-24 22:47:22 +00:00
|
|
|
)
|
|
|
|
|
2016-08-25 21:57:17 +00:00
|
|
|
if (USE_SYSTEM_MINIUPNP)
|
|
|
|
target_include_directories(${PROJECT_NAME} SYSTEM
|
|
|
|
PRIVATE ${MINIUPNP_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
|
|
|
PRIVATE ${MINIUPNP_LIBRARY}
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PRIVATE lib/miniupnp/miniupnpc
|
|
|
|
)
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
|
|
|
libminiupnpc-${upnp_lib_type}
|
|
|
|
)
|
|
|
|
endif()
|
2016-08-24 22:47:22 +00:00
|
|
|
|
|
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
|