diff options
author | Clément Bénier <clement.benier@iot.bzh> | 2018-08-28 14:29:55 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-17 15:03:22 +0100 |
commit | 9cdebd57cf048c1c9ba89943f6ec2f9012bad6fc (patch) | |
tree | 5eb532c616b17bc9157a0fdc853b69ead765e62f /CMakeLists.txt | |
parent | 264b7abf8da063a1942da8db248c2529e6ab3ffc (diff) |
Static lib: pass afb-helpers to a static libraryguppy_6.99.3guppy/6.99.36.99.3
- add afb-timer in helpers: rename ctl-timer from ctl-utilities
into afb-timer
- use the GNUinstalldirs module to set the destination directories.
Change-Id: Ic88105d140edabcc96b091fb23f215db11ccb8c6
Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 103 |
1 files changed, 67 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 21c9ad0..3477ff3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,53 +16,84 @@ # limitations under the License. ########################################################################### -# This is a CMakeLists.txt file meant to be included as submodule into an AGL -# app using app-templates subdmodules +CMAKE_MINIMUM_REQUIRED(VERSION 3.3) +include(GNUInstallDirs) +set(TARGET_NAME "afb-helpers") +set(PROJECT_PRETTY_NAME "Afb Helpers") +set(PROJECT_DESCRIPTION "afb helpers") +set(PROJECT_URL "https://github.com/iotbzh/4a-softmixer") +set(PROJECT_URL "https://gerrit.automotivelinux.org:29418/apps/app-afb-helpers-submodule.git") +set(PROJECT_AUTHOR "Ar Foll, Fulup") +set(PROJECT_AUTHOR_MAIL "fulup@iot.bzh") +set(PROJECT_LICENSE "APL2.0") +set(PROJECT_LANGUAGES "C") # Add target to project dependency list -PROJECT_TARGET_ADD(afb-helpers) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) - set(AFB_HELPERS_SRCS wrap-json.c filescan-utils.c escape.c) +if(NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr") +endif() +add_definitions(-DAFB_BINDING_VERSION=3) - option(AFB_HELPERS_QTWSCLIENT "Enable the Qt's websocket client to Application Framework Binders" OFF) - find_package(CURL) +INCLUDE(FindPkgConfig) +set (PKG_REQUIRED_LIST + afb-daemon + ) - if (AFB_HELPERS_QTWSCLIENT) - message(STATUS "Qt's WebSocket AFB Client: Enabled!") - set(AFB_HELPERS_SRCS ${AFB_HELPERS_SRCS} qafbwebsocketclient.cpp qafbwebsocketclient.h) - find_package(Qt5WebSockets REQUIRED) - else() - message(STATUS "Qt's WebSocket AFB Client: Disabled!") - endif() +# Loop on required package and add options +foreach (PKG_CONFIG ${PKG_REQUIRED_LIST}) + string(REGEX REPLACE "[<>]?=.*$" "" XPREFIX ${PKG_CONFIG}) + PKG_CHECK_MODULES(${XPREFIX} REQUIRED ${PKG_CONFIG}) - if (CURL_FOUND) - message(STATUS "CURL wrapping helpers: Enabled!") - set(AFB_HELPERS_SRCS ${AFB_HELPERS_SRCS} curl-wrap.c) - else() - message(STATUS "CURL wrapping helpers: Disabled!") - endif() + INCLUDE_DIRECTORIES(${${XPREFIX}_INCLUDE_DIRS}) + list(APPEND link_libraries ${${XPREFIX}_LDFLAGS}) + add_compile_options (${${XPREFIX}_CFLAGS}) +endforeach(PKG_CONFIG) - # Define targets - ADD_LIBRARY(${TARGET_NAME} STATIC ${AFB_HELPERS_SRCS}) +set(AFB_HELPERS_SRCS wrap-json.c filescan-utils.c escape.c afb-timer.c) - if (AFB_HELPERS_QTWSCLIENT) - target_link_libraries(${TARGET_NAME} Qt5::WebSockets) - #qt5_use_modules(${TARGET_NAME} WebSockets) - endif() +option(AFB_HELPERS_QTWSCLIENT "Enable the Qt's websocket client to Application Framework Binders" ON) +find_package(CURL REQUIRED) - if (CURL_FOUND) - target_link_libraries(${TARGET_NAME} curl) - endif() +set(AFB_HELPERS_HEADERS afb-helpers-utils.h curl-wrap.h escape.h + filescan-utils.h qafbwebsocketclient.h wrap-json.h afb-timer.h + ) - # Library properties - SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES - OUTPUT_NAME ${TARGET_NAME} - ) +set(AFB_HELPERS_SRCS ${AFB_HELPERS_SRCS} qafbwebsocketclient.cpp qafbwebsocketclient.h) +find_package(Qt5WebSockets REQUIRED) +include_directories(${Qt5WebSockets_INCLUDE_DIRS}) - # Define target includes - TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME} - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - ) +set(AFB_HELPERS_SRCS ${AFB_HELPERS_SRCS} curl-wrap.c) +# Define targets +ADD_LIBRARY(${TARGET_NAME} STATIC ${AFB_HELPERS_SRCS}) + +target_link_libraries(${TARGET_NAME} Qt5::WebSockets) + +target_link_libraries(${TARGET_NAME} curl) + +# Library properties +SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + OUTPUT_NAME ${TARGET_NAME} + ) + +# Define target includes +TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME} + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + ) + +CONFIGURE_FILE(afb-helpers.pc.in afb-helpers.pc @ONLY) +INSTALL(FILES + ${CMAKE_CURRENT_BINARY_DIR}/afb-helpers.pc + DESTINATION + ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) + +INSTALL(TARGETS ${TARGET_NAME} + DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) +INSTALL(FILES ${AFB_HELPERS_HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) |