Merge pull request #583

2c82eb7 fix miniupnpc cmakelist (Riccardo Spagni)
This commit is contained in:
Riccardo Spagni 2015-12-31 09:09:05 +02:00
commit 2f62e0c19d
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD

View File

@ -4,6 +4,7 @@ project (miniupnpc C)
set (MINIUPNPC_VERSION 1.9) set (MINIUPNPC_VERSION 1.9)
set (MINIUPNPC_API_VERSION 15) set (MINIUPNPC_API_VERSION 15)
#[[ - we comment out this block as we don't support these other build types
if (NOT CMAKE_BUILD_TYPE) if (NOT CMAKE_BUILD_TYPE)
if (WIN32) if (WIN32)
set (DEFAULT_BUILD_TYPE MinSizeRel) set (DEFAULT_BUILD_TYPE MinSizeRel)
@ -14,6 +15,7 @@ if (NOT CMAKE_BUILD_TYPE)
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE) FORCE)
endif() endif()
]]
option (UPNPC_BUILD_STATIC "Build static library" TRUE) option (UPNPC_BUILD_STATIC "Build static library" TRUE)
option (UPNPC_BUILD_SHARED "Build shared library" TRUE) option (UPNPC_BUILD_SHARED "Build shared library" TRUE)
@ -39,6 +41,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions (-D_DARWIN_C_SOURCE) add_definitions (-D_DARWIN_C_SOURCE)
endif () endif ()
#[[ - we comment out this block as we already set flags
# Set compiler specific build flags # Set compiler specific build flags
if (CMAKE_COMPILER_IS_GNUC) if (CMAKE_COMPILER_IS_GNUC)
# Set our own default flags at first run. # Set our own default flags at first run.
@ -61,6 +64,7 @@ if (CMAKE_COMPILER_IS_GNUC)
endif (NOT CONFIGURED) endif (NOT CONFIGURED)
endif () endif ()
]]
configure_file (miniupnpcstrings.h.cmake ${CMAKE_BINARY_DIR}/miniupnpcstrings.h) configure_file (miniupnpcstrings.h.cmake ${CMAKE_BINARY_DIR}/miniupnpcstrings.h)
include_directories (${CMAKE_BINARY_DIR}) include_directories (${CMAKE_BINARY_DIR})
@ -93,8 +97,11 @@ if (WIN32)
endif (WIN32) endif (WIN32)
if (WIN32) if (WIN32)
find_library (WINSOCK2_LIBRARY NAMES ws2_32 WS2_32 Ws2_32) # We use set instead of find_library because otherwise static compilation on Windows breaks. Don't ask me why, just roll with it.
find_library (IPHLPAPI_LIBRARY NAMES iphlpapi) # find_library (WINSOCK2_LIBRARY NAMES ws2_32 WS2_32 Ws2_32)
# find_library (IPHLPAPI_LIBRARY NAMES iphlpapi)
set (WINSOCK2_LIBRARY ws2_32)
set (IPHLPAPI_LIBRARY iphlpapi)
set (LDLIBS ${WINSOCK2_LIBRARY} ${IPHLPAPI_LIBRARY} ${LDLIBS}) set (LDLIBS ${WINSOCK2_LIBRARY} ${IPHLPAPI_LIBRARY} ${LDLIBS})
#elseif (CMAKE_SYSTEM_NAME STREQUAL "Solaris") #elseif (CMAKE_SYSTEM_NAME STREQUAL "Solaris")
# find_library (SOCKET_LIBRARY NAMES socket) # find_library (SOCKET_LIBRARY NAMES socket)
@ -173,6 +180,7 @@ install (FILES
DESTINATION include/miniupnpc DESTINATION include/miniupnpc
) )
set (CONFIGURED YES CACHE INTERNAL "") # commented out by Ben Boeckel, who I presume knows what he's doing;)
# set (CONFIGURED YES CACHE INTERNAL "")
# vim: ts=2:sw=2 # vim: ts=2:sw=2