From 833e56341f488d8549b3228ce50e88c49ae83c5f Mon Sep 17 00:00:00 2001 From: manuelValch Date: Tue, 6 Feb 2024 20:28:57 +0100 Subject: [PATCH] Moved find fastcdr to parent CMakeList Moved up findCdr or build default library so that cmake does not fail before building when fastCdr is installed on system. Added message so that user knows when fastCdr is found on its system. Issue: [facontidavide#919] Co-authored-by: manuelValch --- plotjuggler_plugins/ParserROS/CMakeLists.txt | 14 ++++++++++++++ .../ParserROS/rosx_introspection/CMakeLists.txt | 9 --------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/plotjuggler_plugins/ParserROS/CMakeLists.txt b/plotjuggler_plugins/ParserROS/CMakeLists.txt index d2641716a..7f46d90b0 100644 --- a/plotjuggler_plugins/ParserROS/CMakeLists.txt +++ b/plotjuggler_plugins/ParserROS/CMakeLists.txt @@ -3,6 +3,20 @@ add_definitions(${QT_DEFINITIONS}) add_definitions(-DQT_PLUGIN) SET(INTROSPECTION_TESTS OFF CACHE BOOL "Compile the tests") + +# Check if default fastCdr library generation is needed +find_package(fastcdr QUIET) + +if(NOT fastcdr_FOUND ) + # Override Fast-CDR option: compile as static lib + SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Create shared libraries by default") + add_subdirectory(3rdparty/Fast-CDR) + include_directories(3rdparty/Fast-CDR/include) +else() + # Mention that FastCdr has been found on system + message(STATUS "[FastCdr] found, version: ${fastcdr_VERSION}") +endif() + add_subdirectory(rosx_introspection) include_directories( rosx_introspection/include ) diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/CMakeLists.txt b/plotjuggler_plugins/ParserROS/rosx_introspection/CMakeLists.txt index b39ae9412..b645348d6 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/CMakeLists.txt +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/CMakeLists.txt @@ -9,15 +9,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -find_package(fastcdr QUIET) - -if(NOT fastcdr_FOUND ) - # Override Fast-CDR option: compile as static lib - SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Create shared libraries by default") - add_subdirectory(3rdparty/Fast-CDR) - include_directories(3rdparty/Fast-CDR/include) -endif() - ############################################### ## Declare a C++ library ###############################################