+INCLUDE(GNUInstallDirs)
+INCLUDE(CTest)
+
+###########################################################################
+# possible settings
+
+option(AGL_DEVEL "Activates developping features" OFF)
+option(INCLUDE_MONITORING "Activates installation of monitoring" OFF)
+
+option(INCLUDE_SUPERVISOR "Activates installation of supervisor" OFF)
+option(INCLUDE_DBUS_TRANSPARENCY "Allows API transparency over DBUS" OFF)
+option(INCLUDE_LEGACY_BINDING_V1 "Includes the legacy Binding API version 1" OFF)
+option(INCLUDE_LEGACY_BINDING_VDYN "Includes the legacy Binding API version dynamic" OFF)
+
+set(AFS_SUPERVISION_SOCKET "@urn:AGL:afs:supervision:socket" CACHE STRING "Internal socket for supervision")
+set(AFS_SUPERVISOR_PORT 1619 CACHE STRING "Port of service for the supervisor")
+set(AFS_SUPERVISOR_TOKEN HELLO CACHE STRING "Secret token for the supervisor")
+set(UNITDIR_SYSTEM ${CMAKE_INSTALL_LIBDIR}/systemd/system CACHE STRING "Path to systemd system unit files")
+set(INTRINSIC_BINDING_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/afb CACHE STRING "Path to install intrinsic bindings")
+set(SAMPLE_INSTALL_DIR ${CMAKE_INSTALL_FULL_DATADIR}/af-binder CACHE STRING "Path to install samples")
+
+###########################################################################
+
+link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
+
+add_compile_options(-Wall -Wextra -Wconversion)
+add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
+add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
+if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+ add_compile_options(-Werror=maybe-uninitialized)
+elseif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+ add_compile_options(-Werror=sometimes-uninitialized)
+endif()
+add_compile_options(-Werror=implicit-function-declaration)
+add_compile_options(-ffunction-sections -fdata-sections)
+add_compile_options(-fPIC)
+add_compile_options(-g -O2)
+set (CMAKE_CXX_STANDARD 14)
+
+set(CMAKE_C_FLAGS_PROFILING "-g -O2 -pg -U_FORTIFY_SOURCE")
+set(CMAKE_C_FLAGS_DEBUG "-g -O2 -ggdb -U_FORTIFY_SOURCE")
+set(CMAKE_C_FLAGS_RELEASE "-g -O3")
+set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
+
+###########################################################################
+
+INCLUDE(FindThreads)
+FIND_PACKAGE(Threads)
+
+PKG_CHECK_MODULES(json-c REQUIRED json-c)