fix loading of CURL and Backtracing library with CMake (#215)

to build on FreeBSD with default compiler (Clang 4.0)
This commit is contained in:
0x4D616E75 2018-05-17 18:55:15 +02:00 committed by Sebastian Meßmer
parent a686129243
commit 5db592bcc2
4 changed files with 19 additions and 4 deletions

View File

@ -49,7 +49,7 @@ references:
sudo chmod o-w /etc/apt/sources.list.d/clang.list
DEBIAN_FRONTEND=noninteractive sudo apt-get update -qq
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y git ccache $APT_COMPILER_PACKAGE cmake make libcurl4-openssl-dev libcrypto++-dev libssl-dev libfuse-dev python
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y git ccache $APT_COMPILER_PACKAGE cmake3 make libcurl4-openssl-dev libcrypto++-dev libssl-dev libfuse-dev python
# Use /dev/urandom when /dev/random is accessed to use less entropy
sudo cp -a /dev/urandom /dev/random

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_policy(VERSION 2.8)
# note: for clang-tidy, we need cmake 3.6, or (if the return code should be handled correctly, e.g. on CI), we need 3.8.

View File

@ -24,7 +24,7 @@ Requirements
------------
- Git (for getting the source code)
- GCC version >= 4.8 or Clang >= 3.7
- CMake version >= 2.8
- CMake version >= 3.0
- libcurl4 (including development headers)
- Boost libraries version >= 1.56 (including development headers)
- filesystem

View File

@ -50,7 +50,21 @@ set(SOURCES
add_library(${PROJECT_NAME} STATIC ${SOURCES})
target_link_libraries(${PROJECT_NAME} PUBLIC pthread curl)
find_package(CURL)
if(NOT ${CURL_FOUND})
message(FATAL_ERROR "CURL library not found")
endif()
include_directories(${CURL_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${CURL_LIBRARIES})
find_package(Backtrace)
if(NOT ${Backtrace_FOUND})
message(FATAL_ERROR "Backtrace library not found")
endif()
include_directories(${Backtrace_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${Backtrace_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PUBLIC pthread)
# TODO From Crypto++ 5.7 on, it should support cmake with find_package() instead of find_library().
find_library_with_path(CryptoPP cryptopp CRYPTOPP_LIB_PATH)