summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--cmake/FindLibatomic.cmake7
-rw-r--r--src/server/CMakeLists.txt2
3 files changed, 11 insertions, 3 deletions
diff --git a/README.md b/README.md
index 954fbe9..8e7e1df 100644
--- a/README.md
+++ b/README.md
@@ -97,6 +97,7 @@ Note that `afl` is not available on CentOS 8 and should be built from the [origi
```shell
pkg install git \
cmake \
+ gcc \
pkgconf \
fusefs-libs \
jansson \
@@ -138,6 +139,10 @@ A value from the range of appropriate values can be assigend to each configurati
cmake -D<VARIABLE>=<VALUE> [-D ...] ../.
```
+> **Note that the default compiler on FreeBSD 12.1 is clang/llvm and should be changed to gcc by appending the set CMake compiler configuration variable -DCMAKE_C_COMPILER=gcc to the CMake configuration command.**
+
+
+### Cross-Compiling
With the help of CMake, it is also possible to cross-compile the dnbd3 components for a Linux target architecture other than the compiling Linux host architecture. This repository is shipped with two CMake toolchain files to cross-compile all components for the following two Linux target architectures if necessary.
> **Note that all used header files (eg. Linux kernel headers) and libraries (eg. jansson, fuse) for the target architecture are installed and set up properly, so that the cross-compiler can find and use them.**
diff --git a/cmake/FindLibatomic.cmake b/cmake/FindLibatomic.cmake
index f827eae..4f7dea2 100644
--- a/cmake/FindLibatomic.cmake
+++ b/cmake/FindLibatomic.cmake
@@ -13,15 +13,18 @@ set(Libatomic_VERSION ${PKG_Libatomic_VERSION})
find_path(Libatomic_INCLUDE_DIR
NAMES stdatomic.h
- HINTS ${PKG_Libatomic_INCLUDE_DIRS})
+ HINTS ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
+ ${PKG_Libatomic_INCLUDE_DIRS})
find_library(Libatomic_LIBRARY
NAMES atomic
- HINTS ${PKG_Libatomic_LIBRARY_DIRS})
+ HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}
+ ${PKG_Libatomic_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libatomic
FOUND_VAR Libatomic_FOUND
REQUIRED_VARS Libatomic_LIBRARY
+ Libatomic_INCLUDE_DIR
VERSION_VAR Libatomic_VERSION
FAIL_MESSAGE "Library 'atomic' is not available! Please install this required library!")
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
index c56cc9f..a5bd660 100644
--- a/src/server/CMakeLists.txt
+++ b/src/server/CMakeLists.txt
@@ -58,7 +58,7 @@ add_executable(dnbd3-server ${CMAKE_CURRENT_SOURCE_DIR}/altservers.c
${CMAKE_CURRENT_SOURCE_DIR}/uplink.c
${CMAKE_CURRENT_SOURCE_DIR}/urldecode.c)
target_include_directories(dnbd3-server PRIVATE ${JANSSON_INCLUDE_DIR})
-target_link_libraries(dnbd3-server dnbd3-version dnbd3-build dnbd3-shared atomic ${CMAKE_THREAD_LIBS_INIT} ${JANSSON_LIBRARIES})
+target_link_libraries(dnbd3-server dnbd3-version dnbd3-build dnbd3-shared Libatomic::Libatomic ${CMAKE_THREAD_LIBS_INIT} ${JANSSON_LIBRARIES})
if(DNBD3_SERVER_FUSE)
find_package(Fuse REQUIRED)