From 2a948ca6870bd06eb0d14a82646ade43857d8a6a Mon Sep 17 00:00:00 2001 From: Mihai Tudor Panu Date: Thu, 11 Apr 2019 02:40:57 +0000 Subject: [PATCH] cmake: handle tinyb dependency through upm_init_module macro Signed-off-by: Mihai Tudor Panu --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01bc21b9..92adf53a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,6 +155,8 @@ pkg_check_modules (OPENZWAVE libopenzwave) # Check for TinyB pkg_check_modules (TINYB tinyb>=0.5.1) +# And get full path to the tinyb library +find_library(TINYB_LIBRARY NAMES tinyb HINTS ${TINYB_LIBDIR}) # Find JPEG find_package (JPEG) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ac16575d..78d5a5f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -66,6 +66,8 @@ function (_get_dependency_targets target return_variable) # reqlibname list (used in various items like pom files, .pc files, etc elseif (${deplib} MATCHES mraa) list(APPEND ${return_variable} mraa) + elseif (${deplib} MATCHES tinyb) + list(APPEND ${return_variable} tinyb) endif (TARGET ${deplib}) endforeach (deplib ${_dep_libs}) # Uniquify @@ -100,6 +102,8 @@ function (_gen_pkg_config_per_target LABEL) list(APPEND reqlibname ${deplibname}) elseif (${deplib} MATCHES mraa) list(APPEND reqlibname mraa) + elseif (${deplib} MATCHES tinyb) + list(APPEND reqlibname tinyb) endif (TARGET ${deplib}) endforeach (deplib ${DEPLIBS}) # Make sure no dups exist @@ -855,6 +859,9 @@ function(upm_module_init) target_link_libraries (${libname} ${MRAA_LIBRARY}) # Always add a PUBLIC dependency to MRAA include dirs target_include_directories (${libname} PUBLIC ${MRAA_INCLUDE_DIRS}) + elseif (${linkflag} MATCHES tinyb) + target_link_libraries (${libname} ${TINYB_LIBRARY}) + target_include_directories (${libname} PUBLIC ${TINYB_INCLUDE_DIRS}) else () # Else, add the linkflag directly target_link_libraries (${libname} ${linkflag})