summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@iot.bzh>2015-12-10 09:36:34 +0100
committerManuel Bachmann <manuel.bachmann@iot.bzh>2015-12-10 10:06:04 +0100
commit4db4634b28378379bce04f4073c2a511b92b1ee6 (patch)
tree7d7113b1229fe3c77c8760daa0d9ee91204547a9 /CMakeLists.txt
parentaccb3215b180f8e386f896ba0368b7188eaa190e (diff)
Add CMake build files (required by Yocto build process)
We now can use CMake by doing : $ mkdir build $ cd build $ cmake .. $ make $ make install Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt42
1 files changed, 42 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..d7805884
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,42 @@
+PROJECT(afb-daemon C)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+SET(CMAKE_BUILD_TYPE, Debug)
+SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+SET(PROJECT_NAME "AFB Daemon")
+SET(PROJECT_PRETTY_NAME "Application Framework Binder Daemon")
+SET(PROJECT_VERSION "0.1")
+
+INCLUDE(FindPkgConfig)
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckLibraryExists)
+
+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)
+
+IF(CMAKE_BUILD_TYPE MATCHES Debug)
+ CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
+ IF(HAVE_LIBEFENCE)
+ MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
+ SET(libefence_LIBRARIES "-lefence")
+ ENDIF(HAVE_LIBEFENCE)
+ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(json-c REQUIRED json-c)
+PKG_CHECK_MODULES(libmicrohttpd REQUIRED libmicrohttpd)
+
+SET(include_dirs ${INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include ${json-c_INCLUDE_DIRS} ${libmicrohttpd_INCLUDE_DIRS})
+SET(link_libraries ${json-c_LIBRARIES} ${libmicrohttpd_LIBRARIES} ${libefence_LIBRARIES} -lmagic)
+
+ADD_SUBDIRECTORY(src)