aboutsummaryrefslogtreecommitdiff
path: root/external/miniupnpc/CMakeLists.txt
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2014-11-25 21:48:54 +0200
committerRiccardo Spagni <ric@spagni.net>2014-11-25 21:49:00 +0200
commitab7c6c07e71c025a978948760159f823cc48fe37 (patch)
tree076a6ae171a256e68474d3617abbd3715fa579fc /external/miniupnpc/CMakeLists.txt
parentMerge pull request #184 (diff)
parentcmake: work around a bug with implicit link directories (diff)
downloadmonero-ab7c6c07e71c025a978948760159f823cc48fe37.tar.xz
Merge pull request #180
ce71c01 cmake: work around a bug with implicit link directories (Ben Boeckel) de4fc40 mingw: copy required libraries to the build tree (Ben Boeckel) ec54e2f cmake: place binaries together in the build tree (Ben Boeckel) 18c56ab msys: don't use LTO (Ben Boeckel) 5680c9c msys: factor out -Werror on msys (Ben Boeckel) 4751542 msys: look in msys' directory for files (Ben Boeckel) d855fe4 miniupnpc: bump the _POSIX_C_SOURCE feature macro (Ben Boeckel) c696492 unbound: fix getaddrinfo detection for 32-bit windows (Ben Boeckel) e377687 cmake: Windows and static builds need this (Ben Boeckel) 01895dd cmake: fix up link lines (Ben Boeckel) 4b6515c unbound: fix type checking (Ben Boeckel) d43a20f unbound: plumb the libdir up (Ben Boeckel) 7d708e4 cmake: support 2.8.7 (Ben Boeckel) 464c280 cmake: fix up miniupnpc's define (Ben Boeckel) 9689df9 cmake: clean up EXTRA_LIBRARIES (Ben Boeckel) 3b7bdcb cmake: set the project name (Ben Boeckel) 0f0efc4 cmake: prepend to CMAKE_MODULE_PATH (Ben Boeckel) 031e3da cmake: remove scream-make (all-caps functions) (Ben Boeckel) abbd5c0 unbound: import cmake build system (Ben Boeckel) e59b5b7 miniupnpc: clean up build system (Ben Boeckel) 475fe20 cmake: minor cleanups (indentation and typos) (Ben Boeckel) 799e8b2 cmake: use option() for STATIC (Ben Boeckel) c24d22b cmake: clean up if auto-dereferencing (Ben Boeckel) 9ed415a build: inform the build of what generates version.h (Ben Boeckel) eba180a cmake: support git info in released tarballs (Ben Boeckel) eeffac6 cmake: fix up BOOST_IGNORE_SYSTEM_PATHS (Ben Boeckel) a43f1a8 cmake: remove configuration variables (Ben Boeckel) a87ce09 cmake: factor out error messages (Ben Boeckel) 9aa48b6 miniupnpc: clear out else/endfoo command arguments (Ben Boeckel) 8a86ac8 daemon_tests: update cmake code (Ben Boeckel) fa3ff75 gtest: support an external gtest (Ben Boeckel) 7bfcffa cmake: put each test executable in its own directory (Ben Boeckel) f53f047 cmake: handle private vs. public headers (Ben Boeckel) 55ca7d3 cmake: refactor common code with libraries (Ben Boeckel) c773f46 cmake: refactor common code with executables (Ben Boeckel) 89cff7b cmake: put each library into its own directory (Ben Boeckel)
Diffstat (limited to 'external/miniupnpc/CMakeLists.txt')
-rw-r--r--external/miniupnpc/CMakeLists.txt101
1 files changed, 15 insertions, 86 deletions
diff --git a/external/miniupnpc/CMakeLists.txt b/external/miniupnpc/CMakeLists.txt
index 5e4a90bbf..bed9a3d22 100644
--- a/external/miniupnpc/CMakeLists.txt
+++ b/external/miniupnpc/CMakeLists.txt
@@ -4,64 +4,27 @@ project (miniupnpc C)
set (MINIUPNPC_VERSION 1.9)
set (MINIUPNPC_API_VERSION 10)
-if (NOT CMAKE_BUILD_TYPE)
- if (WIN32)
- set (DEFAULT_BUILD_TYPE MinSizeRel)
- else (WIN32)
- set (DEFAULT_BUILD_TYPE RelWithDebInfo)
- endif(WIN32)
- set (CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE} CACHE STRING
- "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
- FORCE)
-endif()
-
option (UPNPC_BUILD_STATIC "Build static library" TRUE)
option (UPNPC_BUILD_SHARED "Build shared library" TRUE)
-if (NOT WIN32)
- option (UPNPC_BUILD_TESTS "Build test executables" TRUE)
-endif (NOT WIN32)
option (NO_GETADDRINFO "Define NO_GETADDRINFO" FALSE)
mark_as_advanced (NO_GETADDRINFO)
if (NO_GETADDRINFO)
add_definitions (-DNO_GETADDRINFO)
-endif (NO_GETADDRINFO)
+endif ()
if (NOT WIN32)
add_definitions (-DMINIUPNPC_SET_SOCKET_TIMEOUT)
- add_definitions (-D_BSD_SOURCE -D_POSIX_C_SOURCE=1)
-else (NOT WIN32)
+ add_definitions (-D_BSD_SOURCE -D_POSIX_C_SOURCE=201112)
+else ()
add_definitions (-D_WIN32_WINNT=0x0501) # XP or higher for getnameinfo and friends
-endif (NOT WIN32)
+endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions (-D_DARWIN_C_SOURCE)
endif ()
-# Set compiler specific build flags
-if (CMAKE_COMPILER_IS_GNUC)
- # Set our own default flags at first run.
- if (NOT CONFIGURED)
-
- if (NOT CMAKE_SYSTEM_NAME STREQUAL "AmigaOS")
- set (_PIC -fPIC)
- endif (CMAKE_SYSTEM_NAME STREQUAL "AmigaOS")
-
- set (CMAKE_C_FLAGS "${_PIC} -Wall $ENV{CFLAGS}" # CMAKE_C_FLAGS gets appended to the other C flags
- CACHE STRING "Flags used by the C compiler during normal builds." FORCE)
- set (CMAKE_C_FLAGS_DEBUG "-g -DDDEBUG"
- CACHE STRING "Flags used by the C compiler during debug builds." FORCE)
- set (CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG"
- CACHE STRING "Flags used by the C compiler during release builds." FORCE)
- set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG"
- CACHE STRING "Flags used by the C compiler during release builds." FORCE)
- set (CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG"
- CACHE STRING "Flags used by the C compiler during release builds." FORCE)
-
- endif (NOT CONFIGURED)
-endif ()
-
configure_file (miniupnpcstrings.h.cmake ${CMAKE_BINARY_DIR}/miniupnpcstrings.h)
include_directories (${CMAKE_BINARY_DIR})
@@ -80,16 +43,16 @@ set (MINIUPNPC_SOURCES
receivedata.c
)
-if (NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "AmigaOS")
+if (NOT WIN32)
set (MINIUPNPC_SOURCES ${MINIUPNPC_SOURCES} minissdpc.c)
-endif (NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "AmigaOS")
+endif ()
if (WIN32)
set_source_files_properties (${MINIUPNPC_SOURCES} PROPERTIES
COMPILE_DEFINITIONS MINIUPNP_STATICLIB
COMPILE_DEFINITIONS MINIUPNP_EXPORTS
)
-endif (WIN32)
+endif ()
if (WIN32)
# find_library (WINSOCK2_LIBRARY NAMES ws2_32 WS2_32 Ws2_32)
@@ -97,63 +60,31 @@ if (WIN32)
set(WINSOCK2_LIBRARY ws2_32)
set(IPHLPAPI_LIBRARY iphlpapi)
set (LDLIBS ${WINSOCK2_LIBRARY} ${IPHLPAPI_LIBRARY} ${LDLIBS})
-#elseif (CMAKE_SYSTEM_NAME STREQUAL "Solaris")
-# find_library (SOCKET_LIBRARY NAMES socket)
-# find_library (NSL_LIBRARY NAMES nsl)
-# find_library (RESOLV_LIBRARY NAMES resolv)
-# set (LDLIBS ${SOCKET_LIBRARY} ${NSL_LIBRARY} ${RESOLV_LIBRARY} ${LDLIBS})
-endif (WIN32)
+endif ()
if (NOT UPNPC_BUILD_STATIC AND NOT UPNPC_BUILD_SHARED)
- message (FATAL "Both shared and static libraries are disabled!")
-endif (NOT UPNPC_BUILD_STATIC AND NOT UPNPC_BUILD_SHARED)
+ message (FATAL "Both shared and static libraries are disabled!")
+endif ()
if (UPNPC_BUILD_STATIC)
add_library (upnpc-static STATIC ${MINIUPNPC_SOURCES})
+ set_target_properties (upnpc-static PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
set_target_properties (upnpc-static PROPERTIES OUTPUT_NAME "miniupnpc")
target_link_libraries (upnpc-static ${LDLIBS})
set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} upnpc-static)
set (UPNPC_LIBRARY_TARGET upnpc-static)
-endif (UPNPC_BUILD_STATIC)
+endif ()
if (UPNPC_BUILD_SHARED)
add_library (upnpc-shared SHARED ${MINIUPNPC_SOURCES})
+ set_target_properties (upnpc-shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
set_target_properties (upnpc-shared PROPERTIES OUTPUT_NAME "miniupnpc")
set_target_properties (upnpc-shared PROPERTIES VERSION ${MINIUPNPC_VERSION})
set_target_properties (upnpc-shared PROPERTIES SOVERSION ${MINIUPNPC_API_VERSION})
target_link_libraries (upnpc-shared ${LDLIBS})
set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} upnpc-shared)
set (UPNPC_LIBRARY_TARGET upnpc-shared)
-endif (UPNPC_BUILD_SHARED)
-
-if (UPNPC_BUILD_TESTS)
- add_executable (testminixml testminixml.c minixml.c igd_desc_parse.c)
- target_link_libraries (testminixml ${LDLIBS})
-
- add_executable (minixmlvalid minixmlvalid.c minixml.c)
- target_link_libraries (minixmlvalid ${LDLIBS})
-
- add_executable (testupnpreplyparse testupnpreplyparse.c
- minixml.c upnpreplyparse.c)
- target_link_libraries (testupnpreplyparse ${LDLIBS})
-
- add_executable (testigddescparse testigddescparse.c
- igd_desc_parse.c minixml.c miniupnpc.c miniwget.c minissdpc.c
- upnpcommands.c upnpreplyparse.c minisoap.c connecthostport.c
- portlistingparse.c receivedata.c
- )
- target_link_libraries (testigddescparse ${LDLIBS})
-
- add_executable (testminiwget testminiwget.c
- miniwget.c miniupnpc.c minisoap.c upnpcommands.c minissdpc.c
- upnpreplyparse.c minixml.c igd_desc_parse.c connecthostport.c
- portlistingparse.c receivedata.c
- )
- target_link_libraries (testminiwget ${LDLIBS})
-
-# set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} testminixml minixmlvalid testupnpreplyparse testigddescparse testminiwget)
-endif (UPNPC_BUILD_TESTS)
-
+endif ()
install (TARGETS ${UPNPC_INSTALL_TARGETS}
RUNTIME DESTINATION bin
@@ -161,7 +92,7 @@ install (TARGETS ${UPNPC_INSTALL_TARGETS}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
)
install (FILES
- miniupnpc.h
+ miniupnpc.h
miniwget.h
upnpcommands.h
igd_desc_parse.h
@@ -173,6 +104,4 @@ install (FILES
DESTINATION include/miniupnpc
)
-set (CONFIGURED YES CACHE INTERNAL "")
-
# vim: ts=2:sw=2