diff options
author | Riccardo Spagni <ric@spagni.net> | 2014-11-25 21:48:54 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2014-11-25 21:49:00 +0200 |
commit | ab7c6c07e71c025a978948760159f823cc48fe37 (patch) | |
tree | 076a6ae171a256e68474d3617abbd3715fa579fc /external/CMakeLists.txt | |
parent | Merge pull request #184 (diff) | |
parent | cmake: work around a bug with implicit link directories (diff) | |
download | monero-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/CMakeLists.txt')
-rw-r--r--[-rwxr-xr-x] | external/CMakeLists.txt | 118 |
1 files changed, 21 insertions, 97 deletions
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 83e9e6dee..a7bcfebe0 100755..100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -38,14 +38,14 @@ find_package(MiniUpnpc QUIET) # FreeBSD doesn't play well with the local copy, so default to using shared -SET(USE_SHARED_MINIUPNPC false) +set(USE_SHARED_MINIUPNPC false) # If we have the correct shared version and we're not building static, use it -IF(STATIC) - SET(USE_SHARED_MINIUPNPC false) -ELSEIF(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER) - SET(USE_SHARED_MINIUPNPC true) -ENDIF() +if(STATIC) + set(USE_SHARED_MINIUPNPC false) +elseif(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER) + set(USE_SHARED_MINIUPNPC true) +endif() if(USE_SHARED_MINIUPNPC) message(STATUS "Using shared miniupnpc found at ${MINIUPNP_INCLUDE_DIR}") @@ -59,7 +59,7 @@ else() else() message(STATUS "Using miniupnpc from local source tree (/external/miniupnpc)") endif() - + 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") @@ -78,98 +78,22 @@ endif() find_package(Unbound) -IF(!UNBOUND_INCLUDE_DIR OR STATIC) - if(STATIC) - message(STATUS "Using libunbound from local source tree for static build") - else() - message(STATUS "Using libunbound from local source tree (/external/unbound)") - endif() - - INCLUDE(ExternalProject) - - FIND_PACKAGE(OpenSSL QUIET) - IF(!OPENSSL_LIBRARIES) - MESSAGE(FATAL_ERROR "${BoldRed}Could not find the openssl library. Please make sure you have installed openssl or libssl-dev or the equivalent${ColourReset}") - ELSE() - MESSAGE(STATUS "Found openssl libraries") - ENDIF() +if(NOT UNBOUND_INCLUDE_DIR OR STATIC) + add_subdirectory(unbound) - FIND_PACKAGE(Expat QUIET) - IF(!EXPAT_LIBRARIES) - MESSAGE(FATAL_ERROR "${BoldRed}Could not find the expat library. Please make sure you have installed libexpat or libexpat-dev or the equivalent${ColourReset}") - ELSE() - MESSAGE(STATUS "Found expat libraries") - ENDIF() - - IF(MINGW) - set(ENV{USE_WINSOCK} 1) - set(ENV{CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - set(ENV{GCC_PREFIX} ${GCC_PREFIX}) - set(ENV{CMAKE_FIND_ROOT_PATH} ${CMAKE_FIND_ROOT_PATH}) - EXTERNALPROJECT_ADD( - libunbound - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/unbound - URL ${CMAKE_CURRENT_SOURCE_DIR}/unbound/ - CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/unbound/monero-config.sh - BUILD_COMMAND $(MAKE) - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build/libtool --mode=install cp ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build/libunbound.la ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build - LOG_DOWNLOAD 1 - LOG_UPDATE 1 - LOG_CONFIGURE 1 - LOG_BUILD 1 - LOG_TEST 1 - LOG_INSTALL 1 - ) - ELSEIF(APPLE) - execute_process(COMMAND brew --prefix OUTPUT_VARIABLE BREW_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE) - EXTERNALPROJECT_ADD( - libunbound - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/unbound - URL ${CMAKE_CURRENT_SOURCE_DIR}/unbound/ - CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/unbound/configure --prefix=${BREW_PREFIX} --enable-shared --enable-static --disable-gost --disable-rpath --with-libevent=no --without-pyunbound --without-pythonmodule --without-pthreads --with-libunbound-only - BUILD_COMMAND $(MAKE) - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build/libtool --mode=install cp ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build/libunbound.la ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build - LOG_DOWNLOAD 1 - LOG_UPDATE 1 - LOG_CONFIGURE 1 - LOG_BUILD 1 - LOG_TEST 1 - LOG_INSTALL 1 - ) - ELSE() - EXTERNALPROJECT_ADD( - libunbound - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/unbound - URL ${CMAKE_CURRENT_SOURCE_DIR}/unbound/ - CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/unbound/configure --disable-shared --enable-static --disable-gost --disable-rpath --with-libevent=no --without-pyunbound --without-pythonmodule --without-pthreads --with-libunbound-only - BUILD_COMMAND $(MAKE) - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build/libtool --mode=install cp ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build/libunbound.la ${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build - LOG_DOWNLOAD 1 - LOG_UPDATE 1 - LOG_CONFIGURE 1 - LOG_BUILD 1 - LOG_TEST 1 - LOG_INSTALL 1 - ) - ENDIF() - set(UNBOUND_STATIC true PARENT_SCOPE) - set(UNBOUND_INCLUDE "${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build" PARENT_SCOPE) - set(UNBOUND_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/unbound/src/libunbound-build/libunbound.a;${OPENSSL_LIBRARIES}" PARENT_SCOPE) -ELSE() - MESSAGE(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}") - IF(UNBOUND_LIBRARIES) - MESSAGE(STATUS "Found libunbound shared library") + set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE) + set(UNBOUND_LIBRARY "unbound" PARENT_SCOPE) + set(UNBOUND_LIBRARY_DIRS "${LIBEVENT2_LIBDIR}" PARENT_SCOPE) +else() + message(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}") + if(UNBOUND_LIBRARIES) + message(STATUS "Found libunbound shared library") set(UNBOUND_STATIC false PARENT_SCOPE) set(UNBOUND_INCLUDE ${UNBOUND_INCLUDE_DIR} PARENT_SCOPE) set(UNBOUND_LIBRARY ${UNBOUND_LIBRARIES} PARENT_SCOPE) - ELSE() - MESSAGE(FATAL_ERROR "${BoldRed}Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent${ColourReset}") - ENDIF() -ENDIF() + set(UNBOUND_LIBRARY_DIRS "" PARENT_SCOPE) + else() + die("Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent") + endif() +endif() |