Merge pull request #705 from bdrung/master

Link against atomic if __atomic_add_fetch_8 is missing
This commit is contained in:
Pavel Odintsov 2018-02-05 23:34:51 +00:00 committed by GitHub
commit c12385b55f
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,9 @@ project(FastNetMon)
# Get convinient paths for all system folders: http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a262fe09
# include(GNUInstallDirs)
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
# Enable it and fix all warnigns!
# add_definitions ("-Wall")
@ -104,6 +107,22 @@ if (USE_NEW_ATOMIC_BUILTINS)
add_definitions(-DUSE_NEW_ATOMIC_BUILTINS)
endif()
CHECK_CXX_SOURCE_COMPILES("
#include <cstdint>
int main() {
uint64_t x = 1;
__atomic_add_fetch(&x, 0, __ATOMIC_RELAXED);
return x;
}
" HAVE__ATOMIC_ADD_FETCH)
if (NOT HAVE__ATOMIC_ADD_FETCH)
check_library_exists(atomic __atomic_add_fetch_8 "" HAVE_LIBATOMIC)
if (HAVE_LIBATOMIC)
target_link_libraries(fastnetmon atomic)
endif()
endif()
# With this flag we can disable PF_RING build via console: cmake .. -DDISABLE_PF_RING_SUPPORT=ON
if (NOT DISABLE_PF_RING_SUPPORT)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")