aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt42
1 files changed, 26 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e908e0dfe..78e4b426f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,13 +87,30 @@ 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)
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)
@@ -184,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}")
@@ -196,11 +213,14 @@ endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
- set(Boost_LIBRARIES "${Boost_LIBRARIES};pthread;mswsock;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};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")
@@ -215,15 +235,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)