From 1e171e5c08b8d244e2180a107401bbfde58d382e Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Sat, 27 Jul 2024 02:13:37 +0200 Subject: [PATCH] handle external deps in apps too --- 3rdparty/wxThings/CMakeLists.txt | 1 + cmakemodules/DeclareAppDependencies.cmake | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/3rdparty/wxThings/CMakeLists.txt b/3rdparty/wxThings/CMakeLists.txt index bb25666f7f..1ec2c688d0 100644 --- a/3rdparty/wxThings/CMakeLists.txt +++ b/3rdparty/wxThings/CMakeLists.txt @@ -20,3 +20,4 @@ target_include_directories( "${MRPT_SOURCE_DIR}/3rdparty/wxThings/" ) target_link_libraries(mrptwxthings PRIVATE imp_wxwidgets) + diff --git a/cmakemodules/DeclareAppDependencies.cmake b/cmakemodules/DeclareAppDependencies.cmake index 17446c6b9d..8d54dec7f1 100644 --- a/cmakemodules/DeclareAppDependencies.cmake +++ b/cmakemodules/DeclareAppDependencies.cmake @@ -31,9 +31,16 @@ macro(DeclareAppDependencies name) foreach (_DEP ${ALL_DEPS}) # Check if all dependencies are to be build: string(REGEX REPLACE "mrpt::(.*)" "\\1" DEP_MRPT_NAME ${_DEP}) + if ("${BUILD_mrpt-${DEP_MRPT_NAME}}" STREQUAL "OFF") - set(AUX_ALL_DEPS_BUILD 0) - message(STATUS "*Warning*: App ${name} cannot be built because dependency mrpt-${DEP_MRPT_NAME} has been disabled!") + # Attempt at using system version? + find_package(mrpt-${DEP_MRPT_NAME}) + if (NOT TARGET mrpt::${DEP_MRPT_NAME}) + set(AUX_ALL_DEPS_BUILD 0) + message(STATUS "*Warning*: App ${name} cannot be built because dependency mrpt-${DEP_MRPT_NAME} has been disabled!") + else() + message(STATUS "*Warning*: App ${name} is using system depency: mrpt-${DEP_MRPT_NAME}") + endif() endif() endforeach()