2015-01-02 17:52:46 +01:00
|
|
|
# Copyright (c) 2014-2015, The Monero Project
|
2014-09-11 08:25:07 +02:00
|
|
|
#
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without modification, are
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
|
|
# conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
|
|
# of conditions and the following disclaimer in the documentation and/or other
|
|
|
|
# materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
|
|
|
# used to endorse or promote products derived from this software without specific
|
|
|
|
# prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
|
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
|
|
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
|
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
|
|
|
|
2014-10-24 20:48:14 +02:00
|
|
|
cmake_minimum_required(VERSION 2.8.7)
|
2014-03-03 23:07:58 +01:00
|
|
|
|
2014-10-23 20:03:54 +02:00
|
|
|
project(bitmonero)
|
|
|
|
|
2014-10-21 19:33:26 +02:00
|
|
|
function (die msg)
|
|
|
|
if (NOT WIN32)
|
|
|
|
string(ASCII 27 Esc)
|
|
|
|
set(ColourReset "${Esc}[m")
|
|
|
|
set(BoldRed "${Esc}[1;31m")
|
|
|
|
else ()
|
|
|
|
set(ColourReset "")
|
|
|
|
set(BoldRed "")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}")
|
|
|
|
endfunction ()
|
2014-09-29 20:13:15 +02:00
|
|
|
|
2014-10-22 21:17:52 +02:00
|
|
|
list(INSERT CMAKE_MODULE_PATH 0
|
|
|
|
"${CMAKE_SOURCE_DIR}/cmake")
|
2014-09-18 00:37:32 +02:00
|
|
|
|
2014-09-22 12:09:46 +02:00
|
|
|
if (NOT DEFINED ENV{DEVELOPER_LOCAL_TOOLS})
|
2014-10-21 20:24:49 +02:00
|
|
|
message(STATUS "Could not find DEVELOPER_LOCAL_TOOLS in env (not required)")
|
|
|
|
set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF)
|
2014-10-21 20:17:32 +02:00
|
|
|
elseif (ENV{DEVELOPER_LOCAL_TOOLS} EQUAL 1)
|
2014-10-21 20:24:49 +02:00
|
|
|
message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 1")
|
|
|
|
set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON)
|
2014-09-22 12:09:46 +02:00
|
|
|
else()
|
2014-10-21 20:24:49 +02:00
|
|
|
message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 0")
|
|
|
|
set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF)
|
2014-09-22 12:09:46 +02:00
|
|
|
endif()
|
2014-09-29 20:13:15 +02:00
|
|
|
|
2014-09-22 12:09:46 +02:00
|
|
|
message(STATUS "BOOST_IGNORE_SYSTEM_PATHS defaults to ${BOOST_IGNORE_SYSTEM_PATHS_DEFAULT}")
|
2014-10-21 19:41:10 +02:00
|
|
|
option(BOOST_IGNORE_SYSTEM_PATHS "Ignore boost system paths for local boost installation" ${BOOST_IGNORE_SYSTEM_PATHS_DEFAULT})
|
2014-09-22 12:09:46 +02:00
|
|
|
|
2014-03-03 23:07:58 +01:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
enable_testing()
|
|
|
|
|
2015-03-02 16:10:16 +01:00
|
|
|
# Check whether we're on a 32-bit or 64-bit system
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL "8")
|
2015-03-02 17:04:58 +01:00
|
|
|
set(DEFAULT_BUILD_64 ON)
|
2015-03-02 16:10:16 +01:00
|
|
|
else()
|
2015-03-02 17:04:58 +01:00
|
|
|
set(DEFAULT_BUILD_64 OFF)
|
|
|
|
endif()
|
2015-03-03 20:57:40 +01:00
|
|
|
option(BUILD_64 "Build for 64-bit? 'OFF' builds for 32-bit." ${DEFAULT_BUILD_64})
|
2015-03-02 17:04:58 +01:00
|
|
|
|
|
|
|
if(BUILD_64)
|
|
|
|
set(ARCH_WIDTH "64")
|
|
|
|
else()
|
|
|
|
set(ARCH_WIDTH "32")
|
2015-03-02 16:10:16 +01:00
|
|
|
endif()
|
2015-03-02 16:20:42 +01:00
|
|
|
message(STATUS "Building for a ${ARCH_WIDTH}-bit system")
|
2015-03-02 16:10:16 +01:00
|
|
|
|
2014-09-09 14:03:42 +02:00
|
|
|
# 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)
|
|
|
|
|
2014-04-09 14:14:35 +02:00
|
|
|
include_directories(src contrib/epee/include external "${CMAKE_BINARY_DIR}/version")
|
2014-03-03 23:07:58 +01:00
|
|
|
|
2014-04-30 19:52:21 +02:00
|
|
|
if(APPLE)
|
2014-04-30 22:50:06 +02:00
|
|
|
include_directories(SYSTEM /usr/include/malloc)
|
2014-04-30 19:52:21 +02:00
|
|
|
endif()
|
|
|
|
|
2014-08-06 18:27:16 +02:00
|
|
|
if(MSVC OR MINGW)
|
|
|
|
set(DEFAULT_STATIC true)
|
|
|
|
else()
|
|
|
|
set(DEFAULT_STATIC false)
|
|
|
|
endif()
|
2014-10-21 20:20:26 +02:00
|
|
|
option(STATIC "Link libraries statically" ${DEFAULT_STATIC})
|
2014-03-03 23:07:58 +01:00
|
|
|
|
2014-11-18 00:09:21 +01:00
|
|
|
if(MINGW)
|
2015-03-02 16:20:42 +01:00
|
|
|
get_filename_component(msys2_install_path "[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS2 ${ARCH_WIDTH}bit;InstallLocation]" ABSOLUTE)
|
|
|
|
set(CMAKE_INCLUDE_PATH "${msys2_install_path}/mingw${ARCH_WIDTH}/include")
|
2014-11-18 23:04:47 +01:00
|
|
|
# This is necessary because otherwise CMake will make Boost libraries -lfoo
|
|
|
|
# rather than a full path. Unfortunately, this makes the shared libraries get
|
|
|
|
# linked due to a bug in CMake which misses putting -static flags around the
|
|
|
|
# -lfoo arguments.
|
|
|
|
list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_DIRECTORIES
|
2015-03-02 16:20:42 +01:00
|
|
|
"${msys2_install_path}/mingw${ARCH_WIDTH}/lib")
|
2014-11-18 23:04:47 +01:00
|
|
|
list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES
|
2015-03-02 16:20:42 +01:00
|
|
|
"${msys2_install_path}/mingw${ARCH_WIDTH}/lib")
|
2014-11-18 00:09:21 +01:00
|
|
|
endif()
|
|
|
|
|
2014-10-21 20:24:49 +02:00
|
|
|
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()
|
2014-10-06 18:46:18 +02:00
|
|
|
|
2015-01-26 06:36:09 +01:00
|
|
|
# default database:
|
|
|
|
# should be lmdb for testing, memory for production still
|
|
|
|
# set(DATABASE memory)
|
|
|
|
set(DATABASE lmdb)
|
|
|
|
|
|
|
|
if (DEFINED ENV{DATABASE})
|
|
|
|
set(DATABASE $ENV{DATABASE})
|
|
|
|
message(STATUS "DATABASE set: ${DATABASE}")
|
|
|
|
else()
|
|
|
|
message(STATUS "Could not find DATABASE in env (not required unless you want to change database type from default: ${DATABASE})")
|
|
|
|
endif()
|
|
|
|
if (DATABASE STREQUAL "lmdb")
|
|
|
|
set(BLOCKCHAIN_DB DB_LMDB)
|
|
|
|
elseif (DATABASE STREQUAL "memory")
|
|
|
|
set(BLOCKCHAIN_DB DB_MEMORY)
|
|
|
|
else()
|
|
|
|
die("Invalid database type: ${DATABASE}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}")
|
|
|
|
|
2014-06-11 19:15:23 +02:00
|
|
|
if (UNIX AND NOT APPLE)
|
|
|
|
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
|
2014-06-13 06:01:04 +02:00
|
|
|
find_package(Threads)
|
2014-06-11 19:15:23 +02:00
|
|
|
endif()
|
|
|
|
|
2014-10-06 15:00:06 +02:00
|
|
|
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
|
2014-09-24 20:38:24 +02:00
|
|
|
include_directories(${UNBOUND_INCLUDE})
|
2014-10-22 00:39:15 +02:00
|
|
|
link_directories(${UNBOUND_LIBRARY_DIRS})
|
2014-09-17 23:44:35 +02:00
|
|
|
|
2014-12-01 20:15:50 +01:00
|
|
|
# Final setup for rapidjson
|
|
|
|
include_directories(external/rapidjson)
|
|
|
|
|
2015-01-19 00:30:31 +01:00
|
|
|
# Final setup for liblmdb
|
2014-12-06 16:47:49 +01:00
|
|
|
include_directories(${LMDB_INCLUDE})
|
2014-10-23 21:35:49 +02:00
|
|
|
|
2014-03-03 23:07:58 +01:00
|
|
|
if(MSVC)
|
|
|
|
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
|
|
|
|
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760")
|
|
|
|
if(STATIC)
|
|
|
|
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
|
|
|
string(REPLACE "/MD" "/MT" ${VAR} "${${VAR}}")
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
include_directories(SYSTEM src/platform/msc)
|
|
|
|
else()
|
|
|
|
set(ARCH native CACHE STRING "CPU to build for: -march value or default")
|
2014-10-21 20:17:32 +02:00
|
|
|
if(ARCH STREQUAL "default")
|
2014-03-03 23:07:58 +01:00
|
|
|
set(ARCH_FLAG "")
|
|
|
|
else()
|
|
|
|
set(ARCH_FLAG "-march=${ARCH}")
|
|
|
|
endif()
|
2014-11-18 00:10:07 +01:00
|
|
|
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized")
|
|
|
|
if(NOT MINGW)
|
|
|
|
set(WARNINGS "${WARNINGS} -Werror")
|
|
|
|
endif()
|
2014-03-03 23:07:58 +01:00
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
|
|
set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration")
|
|
|
|
else()
|
|
|
|
set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized")
|
|
|
|
endif()
|
|
|
|
if(MINGW)
|
2014-08-06 18:32:59 +02:00
|
|
|
set(WARNINGS "${WARNINGS} -Wno-error=unused-value -Wno-error=unused-but-set-variable")
|
2014-08-06 18:42:24 +02:00
|
|
|
set(MINGW_FLAG "${MINGW_FLAG} -DWIN32_LEAN_AND_MEAN")
|
2014-08-06 18:43:01 +02:00
|
|
|
set(Boost_THREADAPI win32)
|
2014-03-03 23:07:58 +01:00
|
|
|
include_directories(SYSTEM src/platform/mingw)
|
2014-11-18 00:10:52 +01:00
|
|
|
# mingw doesn't support LTO (multiple definition errors at link time)
|
|
|
|
set(USE_LTO_DEFAULT false)
|
2014-03-03 23:07:58 +01:00
|
|
|
endif()
|
|
|
|
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
|
|
|
|
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
|
|
|
|
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/utils/test-static-assert.c" COMPILE_DEFINITIONS "-std=c11")
|
|
|
|
if(STATIC_ASSERT_RES)
|
|
|
|
set(STATIC_ASSERT_FLAG "")
|
|
|
|
else()
|
|
|
|
set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert")
|
|
|
|
endif()
|
2015-01-26 22:19:53 +01:00
|
|
|
|
|
|
|
option(NO_AES "Explicitly disable AES support" ${NO_AES})
|
|
|
|
|
|
|
|
if (NO_AES)
|
|
|
|
message(STATUS "Disabling AES support")
|
2015-01-27 08:05:47 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG}")
|
2015-01-26 22:19:53 +01:00
|
|
|
else()
|
|
|
|
message(STATUS "Enabling AES support")
|
2015-01-27 06:45:21 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
|
2015-01-26 22:19:53 +01:00
|
|
|
endif()
|
|
|
|
|
2014-04-30 22:50:06 +02:00
|
|
|
if(APPLE)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0")
|
|
|
|
endif()
|
2014-03-03 23:07:58 +01:00
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8))
|
|
|
|
set(DEBUG_FLAGS "-g3 -Og")
|
|
|
|
else()
|
|
|
|
set(DEBUG_FLAGS "-g3 -O0")
|
|
|
|
endif()
|
2014-08-06 18:52:25 +02:00
|
|
|
|
2014-05-22 13:00:48 +02:00
|
|
|
set(RELEASE_FLAGS "-Ofast -DNDEBUG -Wno-unused-variable")
|
2014-08-06 18:52:25 +02:00
|
|
|
|
2014-08-08 01:34:10 +02:00
|
|
|
if(NOT DEFINED USE_LTO_DEFAULT)
|
|
|
|
set(USE_LTO_DEFAULT true)
|
|
|
|
endif()
|
|
|
|
set(USE_LTO ${USE_LTO_DEFAULT} CACHE BOOL "Use Link-Time Optimization (Release mode only)")
|
2014-09-15 22:47:26 +02:00
|
|
|
|
|
|
|
# There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled, so explicitly disable
|
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
2014-10-21 20:24:49 +02:00
|
|
|
set(USE_LTO false)
|
2014-09-15 22:47:26 +02:00
|
|
|
endif()
|
2014-08-06 18:52:25 +02:00
|
|
|
if(USE_LTO)
|
2014-05-22 13:00:48 +02:00
|
|
|
set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto")
|
2014-08-06 18:52:25 +02:00
|
|
|
if(STATIC)
|
|
|
|
set(RELEASE_FLAGS "${RELEASE_FLAGS} -ffat-lto-objects")
|
|
|
|
endif()
|
|
|
|
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
|
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0))
|
|
|
|
set(CMAKE_AR "gcc-ar")
|
|
|
|
set(CMAKE_RANLIB "gcc-ranlib")
|
|
|
|
endif()
|
2014-05-22 13:00:48 +02:00
|
|
|
endif()
|
2014-08-06 18:52:25 +02:00
|
|
|
|
2014-03-03 23:07:58 +01:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
2014-09-15 08:08:03 +02:00
|
|
|
if(STATIC AND NOT APPLE AND NOT FREEBSD)
|
2014-09-15 23:17:24 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
2014-03-03 23:07:58 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2014-09-22 12:30:53 +02:00
|
|
|
if (BOOST_IGNORE_SYSTEM_PATHS)
|
2014-10-21 20:24:49 +02:00
|
|
|
set(Boost_NO_SYSTEM_PATHS TRUE)
|
2014-09-22 12:30:53 +02:00
|
|
|
endif()
|
|
|
|
|
2014-03-03 23:07:58 +01:00
|
|
|
if(STATIC)
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
set(Boost_USE_STATIC_RUNTIME ON)
|
|
|
|
endif()
|
2014-10-06 18:56:59 +02:00
|
|
|
find_package(Boost 1.53 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
|
2014-09-29 20:13:15 +02:00
|
|
|
|
|
|
|
if(NOT Boost_FOUND)
|
2014-10-21 19:33:26 +02:00
|
|
|
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.53 or 1.55+) or the equivalent")
|
2014-09-29 20:13:15 +02:00
|
|
|
endif()
|
|
|
|
|
2014-10-21 20:17:32 +02:00
|
|
|
if((Boost_MAJOR_VERSION EQUAL 1) AND (Boost_MINOR_VERSION EQUAL 54))
|
2014-10-21 19:33:26 +02:00
|
|
|
die("Boost version 1.54 is unsupported due to a bug (see: http://goo.gl/RrCFmA), please install Boost 1.53 or 1.55 and above")
|
2014-03-03 23:07:58 +01:00
|
|
|
endif()
|
2014-09-29 20:13:15 +02:00
|
|
|
|
2014-03-03 23:07:58 +01:00
|
|
|
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
|
|
|
if(MINGW)
|
2014-10-23 20:04:08 +02:00
|
|
|
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi)
|
2014-09-15 08:08:03 +02:00
|
|
|
elseif(APPLE OR FREEBSD)
|
2014-10-06 22:29:07 +02:00
|
|
|
set(EXTRA_LIBRARIES "")
|
2014-04-30 22:50:06 +02:00
|
|
|
elseif(NOT MSVC)
|
2014-10-06 22:29:07 +02:00
|
|
|
find_library(RT rt)
|
|
|
|
set(EXTRA_LIBRARIES ${RT} ${PTHREAD} ${DL})
|
2014-03-03 23:07:58 +01:00
|
|
|
endif()
|
|
|
|
|
2014-10-21 19:52:24 +02:00
|
|
|
include(version.cmake)
|
2014-03-03 23:07:58 +01:00
|
|
|
|
|
|
|
add_subdirectory(src)
|
2014-12-01 19:00:22 +01:00
|
|
|
|
|
|
|
if(BUILD_TESTS)
|
|
|
|
add_subdirectory(tests)
|
2015-01-02 17:52:46 +01:00
|
|
|
endif()
|