diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-05-29 18:03:25 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-05-29 18:03:25 +0200 |
commit | 791e07d6476f6758598a68749185a807da253316 (patch) | |
tree | 1acf7e80294590af4212368b76ef32ad1eb293f4 /CMakeLists.txt | |
parent | 3dbe2d3eeeec9c1d3cf82f41378b306499b9d41b (diff) |
Moves library resolution on top (hack)
Avoid to tune executable byu executable.
Should be redefined later.
Change-Id: I02e55e642c1797768b7dbcd8406f59199a56891d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c3fa0e28..bc201a2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,20 +57,57 @@ set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage") ########################################################################### -PKG_CHECK_MODULES(json-c REQUIRED json-c) - INCLUDE(FindThreads) FIND_PACKAGE(Threads) -SET(include_dirs +PKG_CHECK_MODULES(json-c REQUIRED json-c) + +CHECK_INCLUDE_FILES(magic.h HAVE_MAGIC_H) +CHECK_LIBRARY_EXISTS(magic magic_load "" HAVE_LIBMAGIC_SO) +IF(HAVE_MAGIC_H) + IF(HAVE_LIBMAGIC_SO) + SET(HAVE_LIBMAGIC "1") + ENDIF(HAVE_LIBMAGIC_SO) +ENDIF(HAVE_MAGIC_H) + +IF(NOT HAVE_LIBMAGIC) + MESSAGE(FATAL_ERROR "\"magic.h\" or \"libmagic.so\" missing. + Please install the \"file-devel\" or \"libmagic-dev\" package !") +ENDIF(NOT HAVE_LIBMAGIC) +ADD_DEFINITIONS(-DUSE_MAGIC_MIME_TYPE) + +PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222) +PKG_CHECK_MODULES(libmicrohttpd REQUIRED libmicrohttpd>=0.9.54) +PKG_CHECK_MODULES(openssl REQUIRED openssl) +PKG_CHECK_MODULES(uuid REQUIRED uuid) +PKG_CHECK_MODULES(cynara cynara-client) + +IF(cynara_FOUND) + ADD_DEFINITIONS(-DBACKEND_PERMISSION_IS_CYNARA) +ENDIF(cynara_FOUND) + +INCLUDE_DIRECTORIES( ${INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include ${json-c_INCLUDE_DIRS} - ) + ${libsystemd_INCLUDE_DIRS} + ${libmicrohttpd_INCLUDE_DIRS} + ${uuid_INCLUDE_DIRS} + ${openssl_INCLUDE_DIRS} + ${cynara_INCLUDE_DIRS} +) SET(link_libraries ${CMAKE_THREAD_LIBS_INIT} ${json-c_LDFLAGS} + ${libsystemd_LDFLAGS} + ${libmicrohttpd_LDFLAGS} + ${uuid_LDFLAGS} + ${openssl_LDFLAGS} + ${cynara_LDFLAGS} + -lmagic + -ldl + -lrt ) SET(binding_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb) |