From cee87473adb609aff52c12cff174fd2ad58f5d1d Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Mon, 6 Oct 2014 15:00:06 +0200 Subject: build libunbound from external if no local libunbound or for static builds --- CMakeLists.txt | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index e908e0dfe..b9bcc411c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,8 +92,17 @@ if (UNIX AND NOT APPLE) find_package(Threads) endif() -# Find unbound - don't move this to the end, cmake is weird about this -find_package(Unbound REQUIRED) +add_subdirectory(external) + +# Final setup for miniupnpc +if(UPNP_STATIC) + add_definitions("-DUPNP_STATIC") +else() + add_definitions("-DUPNP_DYNAMIC") + include_directories(${UPNP_INCLUDE}) +endif() + +# Final setup for libunbound include_directories(${UNBOUND_INCLUDE}) if(MSVC) @@ -215,15 +224,5 @@ else() add_custom_target(version ALL) endif() -add_subdirectory(external) - -# Final setup for miniupnpc -if(UPNP_STATIC) - add_definitions("-DUPNP_STATIC") -else() - add_definitions("-DUPNP_DYNAMIC") - include_directories(${UPNP_INCLUDE}) -endif() - add_subdirectory(src) add_subdirectory(tests) -- cgit v1.2.3 From 6b7ac4b37f6a3ed752e1db1e1be1a98b6ad6f19f Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Mon, 6 Oct 2014 18:46:18 +0200 Subject: enforce static libraries when building statically --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b9bcc411c..54565464c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,14 @@ else() endif() set(STATIC ${DEFAULT_STATIC} CACHE BOOL "Link libraries statically") +IF(STATIC) + IF(MSVC) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + ELSE() + SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + ENDIF() +ENDIF() + if (UNIX AND NOT APPLE) # Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail find_package(Threads) -- cgit v1.2.3 From 1afba7311ee82aa3f951ace1dde38f179703b385 Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Mon, 6 Oct 2014 18:56:59 +0200 Subject: quieten CMake when it can't find packages --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 54565464c..633a5e8d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,7 +201,7 @@ if(STATIC) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_RUNTIME ON) endif() -find_package(Boost 1.53 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options) +find_package(Boost 1.53 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options) if(NOT Boost_FOUND) MESSAGE(FATAL_ERROR "${BoldRed}Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.53 or 1.55+) or the equivalent${ColourReset}") -- cgit v1.2.3 From b05e27f8b1be83287441f82cb2f19a37aed2c1b6 Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Mon, 6 Oct 2014 21:17:31 +0200 Subject: need to link with -ldl on Linux when building statically --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 633a5e8d2..6db1a723d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,6 +217,7 @@ if(MINGW) elseif(APPLE OR FREEBSD) set(Boost_LIBRARIES "${Boost_LIBRARIES}") elseif(NOT MSVC) + set(Boost_LIBRARIES "${Boost_LIBRARIES};ld") #set(Boost_LIBRARIES "${Boost_LIBRARIES};rt;pthread") endif() -- cgit v1.2.3 From 2cf94c1321438eb66ffefca547b74f746d7c283a Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Mon, 6 Oct 2014 22:29:07 +0200 Subject: fix for mingw not playing nicely with libunbound configure, fix for correctly finding static libs on various operating systems --- CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 6db1a723d..cdfb7d141 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,12 +213,17 @@ endif() include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) if(MINGW) - set(Boost_LIBRARIES "${Boost_LIBRARIES};pthread;mswsock;ws2_32") + find_library(PTHREAD pthread) + find_library(MSWSOCK mswsock) + find_library(WS2_32 ws2_32) + set(EXTRA_LIBRARIES ${PTHREAD} ${MSWSOCK} ${WS2_32}) elseif(APPLE OR FREEBSD) - set(Boost_LIBRARIES "${Boost_LIBRARIES}") + set(EXTRA_LIBRARIES "") elseif(NOT MSVC) - set(Boost_LIBRARIES "${Boost_LIBRARIES};ld") - #set(Boost_LIBRARIES "${Boost_LIBRARIES};rt;pthread") + find_library(RT rt) + find_library(PTHREAD pthread) + find_library(DL dl) + set(EXTRA_LIBRARIES ${RT} ${PTHREAD} ${DL}) endif() file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version") -- cgit v1.2.3 From 26728d94fe8390ecb7a7e88d964da54475357258 Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Mon, 6 Oct 2014 22:34:44 +0200 Subject: mingw library tweaks --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index cdfb7d141..78e4b426f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,10 +213,7 @@ endif() include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) if(MINGW) - find_library(PTHREAD pthread) - find_library(MSWSOCK mswsock) - find_library(WS2_32 ws2_32) - set(EXTRA_LIBRARIES ${PTHREAD} ${MSWSOCK} ${WS2_32}) + set(EXTRA_LIBRARIES pthread;mswsock;ws2_32) elseif(APPLE OR FREEBSD) set(EXTRA_LIBRARIES "") elseif(NOT MSVC) -- cgit v1.2.3