From a87ce0946192ab6ea3668298565a24bf66724691 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 13:33:26 -0400 Subject: cmake: factor out error messages Instead of using BoldRed and ColourReset everywhere, wrap it up in a function. --- external/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'external/CMakeLists.txt') diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 83e9e6dee..b1fa8b2ff 100755 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -89,14 +89,14 @@ IF(!UNBOUND_INCLUDE_DIR OR STATIC) 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}") + die("Could not find the openssl library. Please make sure you have installed openssl or libssl-dev or the equivalent") ELSE() MESSAGE(STATUS "Found openssl libraries") ENDIF() 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}") + die("Could not find the expat library. Please make sure you have installed libexpat or libexpat-dev or the equivalent") ELSE() MESSAGE(STATUS "Found expat libraries") ENDIF() @@ -170,6 +170,6 @@ ELSE() 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}") + 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() -- cgit v1.2.3 From 475fe209a8a18657796b7c694f4bfb298ce2aa95 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 14:24:49 -0400 Subject: cmake: minor cleanups (indentation and typos) --- external/CMakeLists.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 external/CMakeLists.txt (limited to 'external/CMakeLists.txt') diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt old mode 100755 new mode 100644 -- cgit v1.2.3 From abbd5c0bdb5541aa8c75beea9e8a119297b6d76f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 18:39:15 -0400 Subject: unbound: import cmake build system --- external/CMakeLists.txt | 88 ++++--------------------------------------------- 1 file changed, 6 insertions(+), 82 deletions(-) (limited to 'external/CMakeLists.txt') diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index b1fa8b2ff..eaac66cd0 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -78,90 +78,13 @@ 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) - die("Could not find the openssl library. Please make sure you have installed openssl or libssl-dev or the equivalent") - ELSE() - MESSAGE(STATUS "Found openssl libraries") - ENDIF() +IF(NOT UNBOUND_INCLUDE_DIR OR STATIC) + add_subdirectory(unbound) - FIND_PACKAGE(Expat QUIET) - IF(!EXPAT_LIBRARIES) - die("Could not find the expat library. Please make sure you have installed libexpat or libexpat-dev or the equivalent") - 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) + set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE) + set(UNBOUND_LIBRARY "unbound" PARENT_SCOPE) + set(UNBOUND_LIBRARY_DIRS "${LIBEVENT2_LIBRARY_DIRS}" PARENT_SCOPE) ELSE() MESSAGE(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}") IF(UNBOUND_LIBRARIES) @@ -169,6 +92,7 @@ ELSE() set(UNBOUND_STATIC false PARENT_SCOPE) set(UNBOUND_INCLUDE ${UNBOUND_INCLUDE_DIR} PARENT_SCOPE) set(UNBOUND_LIBRARY ${UNBOUND_LIBRARIES} PARENT_SCOPE) + 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() -- cgit v1.2.3 From 031e3da72473b4d2c51ce9ff25ede75bd2c61a90 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 22 Oct 2014 15:17:32 -0400 Subject: cmake: remove scream-make (all-caps functions) --- external/CMakeLists.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'external/CMakeLists.txt') diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index eaac66cd0..97bdd9af5 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,22 +78,22 @@ endif() find_package(Unbound) -IF(NOT UNBOUND_INCLUDE_DIR OR STATIC) +if(NOT UNBOUND_INCLUDE_DIR OR STATIC) add_subdirectory(unbound) set(UNBOUND_STATIC true PARENT_SCOPE) set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE) set(UNBOUND_LIBRARY "unbound" PARENT_SCOPE) set(UNBOUND_LIBRARY_DIRS "${LIBEVENT2_LIBRARY_DIRS}" PARENT_SCOPE) -ELSE() - MESSAGE(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}") - IF(UNBOUND_LIBRARIES) - MESSAGE(STATUS "Found libunbound shared library") +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) set(UNBOUND_LIBRARY_DIRS "" PARENT_SCOPE) - ELSE() + 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() + endif() +endif() -- cgit v1.2.3 From d43a20f8f41b0d10b09a7cd6e1940d4eca41a125 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 24 Oct 2014 15:29:56 -0400 Subject: unbound: plumb the libdir up This is necessary for static builds where the linking is passed around to dependent targets, but the library is lost. --- external/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'external/CMakeLists.txt') diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 97bdd9af5..a7bcfebe0 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -84,7 +84,7 @@ if(NOT UNBOUND_INCLUDE_DIR OR STATIC) set(UNBOUND_STATIC true PARENT_SCOPE) set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE) set(UNBOUND_LIBRARY "unbound" PARENT_SCOPE) - set(UNBOUND_LIBRARY_DIRS "${LIBEVENT2_LIBRARY_DIRS}" 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) -- cgit v1.2.3