diff options
author | Thomas Winget <tewinget@gmail.com> | 2014-09-17 15:17:31 -0400 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2014-09-23 22:58:02 +0200 |
commit | dea98df6b1ae9a3f5b062f9d0be61e1fc1313b28 (patch) | |
tree | 8befc6cae00030d3a4db0077fb7c00f7de771399 | |
parent | Initial commit of DNS code (diff) | |
download | monero-dea98df6b1ae9a3f5b062f9d0be61e1fc1313b28.tar.xz |
Updated CMake files -- added libunbound linker flag
CMake config file written, but was unable to test/get it working
properly because of a bug in CMake with functions related to
find_package. Simple "-lunbound" flag used in its stead for now. May
not build on non-Linux systems, not sure yet.
-rw-r--r-- | CMake/FindUnbound.cmake | 55 | ||||
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 14 |
4 files changed, 71 insertions, 11 deletions
diff --git a/CMake/FindUnbound.cmake b/CMake/FindUnbound.cmake new file mode 100644 index 000000000..3d2e8f6d7 --- /dev/null +++ b/CMake/FindUnbound.cmake @@ -0,0 +1,55 @@ +# Copyright (c) 2014, The Monero Project +# 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. + +include (CheckIncludeFiles) +include (CheckLibraryExists) +include (CheckSymbolExists) + +set (Unbound_FOUND FALSE) +MESSAGE("Attempting to find libunbound") + +#FIND_PATH("unbound.h" CMAKE_HAVE_UNBOUND_H) +MESSAGE("CMAKE_INCLUDE_PATH: ${CMAKE_INCLUDE_PATH}") +MESSAGE("CMAKE_SYSTEM_INCLUDE_PATH: ${CMAKE_SYSTEM_INCLUDE_PATH}") +CHECK_INCLUDE_FILES("unbound.h" CMAKE_HAVE_UNBOUND_H) +MESSAGE("CMAKE_HAVE_UNBOUND_H: ${CMAKE_HAVE_UNBOUND_H}") + +if(CMAKE_HAVE_UNBOUND_H) + + MESSAGE("unbound.h found") + + CHECK_LIBRARY_EXISTS(unbound ub_ctx_create "" CMAKE_HAVE_UNBOUND) + + if(CMAKE_HAVE_UNBOUND) + MESSAGE("-lunbound works?") + set(CMAKE_UNBOUND_LIB "-lunbound") + set(Unbound_FOUND TRUE) + endif() +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Unbound DEFAULT_MSG Unbound_FOUND) diff --git a/CMakeLists.txt b/CMakeLists.txt index 875674733..6a2c66bc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,11 @@ else() add_custom_target(version ALL) endif() +# <expletive deleted> CMake bug making this not work. +#find_package(Unbound REQUIRED) +# Won't make sure this works, because that's broken. +set(CMAKE_UNBOUND_LIB "-lunbound") + add_subdirectory(external) # Final setup for miniupnpc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 28bffea1b..7cef257de 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -60,13 +60,13 @@ add_library(cryptonote_core ${CRYPTONOTE_CORE}) add_executable(daemon ${DAEMON} ${P2P} ${CRYPTONOTE_PROTOCOL}) add_executable(connectivity_tool ${CONN_TOOL}) add_executable(simpleminer ${MINER}) -target_link_libraries(daemon rpc cryptonote_core crypto common ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(connectivity_tool cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(simpleminer cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(daemon rpc cryptonote_core crypto common ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) +target_link_libraries(connectivity_tool cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) +target_link_libraries(simpleminer cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) add_library(rpc ${RPC}) add_library(wallet ${WALLET}) add_executable(simplewallet ${SIMPLEWALLET} ) -target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) add_dependencies(daemon version) add_dependencies(rpc version) add_dependencies(simplewallet version) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8bc68d9b6..1c0bff676 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -61,16 +61,16 @@ add_executable(unit_tests ${UNIT_TESTS}) add_executable(net_load_tests_clt net_load_tests/clt.cpp) add_executable(net_load_tests_srv net_load_tests/srv.cpp) -target_link_libraries(core_proxy cryptonote_core common crypto ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(coretests cryptonote_core common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(core_proxy cryptonote_core common crypto ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) +target_link_libraries(coretests cryptonote_core common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) target_link_libraries(difficulty-tests cryptonote_core) -target_link_libraries(functional_tests cryptonote_core wallet common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(functional_tests cryptonote_core wallet common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) target_link_libraries(hash-tests crypto) target_link_libraries(hash-target-tests crypto cryptonote_core) -target_link_libraries(performance_tests cryptonote_core common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(unit_tests cryptonote_core common crypto gtest_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(net_load_tests_clt cryptonote_core common crypto gtest_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(net_load_tests_srv cryptonote_core common crypto gtest_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(performance_tests cryptonote_core common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) +target_link_libraries(unit_tests gtest_main cryptonote_core wallet crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) +target_link_libraries(net_load_tests_clt cryptonote_core common crypto gtest_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) +target_link_libraries(net_load_tests_srv cryptonote_core common crypto gtest_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} ${CMAKE_UNBOUND_LIB}) if(NOT MSVC) set_property(TARGET gtest gtest_main unit_tests net_load_tests_clt net_load_tests_srv APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-sign-compare") |