diff options
-rw-r--r-- | CMakeLists.txt | 17 | ||||
-rwxr-xr-x | external/CMakeLists.txt | 22 |
2 files changed, 29 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c5a7220e9..9614d7028 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,23 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(CMAKE_CONFIGURATION_TYPES "Debug;Release") enable_testing() +# Check if we're on FreeBSD so we can exclude the local miniupnpc (it should be installed from ports instead) +# CMAKE_SYSTEM_NAME checks are commonly known, but specifically taken from libsdl's CMakeLists +if(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*") + set(FREEBSD TRUE) +elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD") + set(FREEBSD TRUE) +endif() + +# TODO: check bsdi, NetBSD, OpenBSD, to see if they need the same FreeBSD changes +# +# elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*") +# set(NETBSD TRUE) +# elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*") +# set(OPENBSD TRUE) +# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") +# set(BSDI TRUE) + function(set_static_flags) if (NOT APPLE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 0a7a5d1ae..547fb7e96 100755 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,11 +1,13 @@ -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") -add_subdirectory(miniupnpc) +if(NOT FREEBSD) + 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") + add_subdirectory(miniupnpc) -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_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() +endif()
\ No newline at end of file |