From: =?utf-8?q?Timo_R=C3=B6hling?= Date: Sat, 16 Oct 2021 12:08:34 +0200 Subject: Make idlc an optional dependency Forwarded: not-needed We do not want cyclonedds-tools to be a hard dependency of cyclonedds-dev, because we need to install the build arch version for cross compilation, which would conflict with the host arch version. This way, we can turn cyclonedds-tools into a Recommends --- PackageConfig.cmake.in | 4 +--- cmake/Modules/Generate.cmake | 4 ++-- src/tools/idlc/CMakeLists.txt | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/PackageConfig.cmake.in b/PackageConfig.cmake.in index 5d387a6..74254d0 100644 --- a/PackageConfig.cmake.in +++ b/PackageConfig.cmake.in @@ -17,6 +17,4 @@ if(@CYCLONE_BUILD_WITH_ICEORYX@) endif() include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") -if(TARGET CycloneDDS::idlc) - include("${CMAKE_CURRENT_LIST_DIR}/idlc/Generate.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/idlc/Generate.cmake") diff --git a/cmake/Modules/Generate.cmake b/cmake/Modules/Generate.cmake index 0ed67d6..fdfbc07 100644 --- a/cmake/Modules/Generate.cmake +++ b/cmake/Modules/Generate.cmake @@ -40,13 +40,13 @@ function(IDLC_GENERATE_GENERIC) IDLC "${options}" "${one_value_keywords}" "${multi_value_keywords}" "" ${ARGN}) # find idlc binary - if(CMAKE_CROSSCOMPILING) + if(CMAKE_CROSSCOMPILING OR NOT TARGET CycloneDDS::idlc) find_program(_idlc_executable idlc NO_CMAKE_FIND_ROOT_PATH REQUIRED) if(_idlc_executable) set(_idlc_depends "") else() - message(FATAL_ERROR "Cannot find idlc executable") + message(FATAL_ERROR "Cannot find idlc executable. Please install package 'cyclonedds-tools'.") endif() else() set(_idlc_executable CycloneDDS::idlc) diff --git a/src/tools/idlc/CMakeLists.txt b/src/tools/idlc/CMakeLists.txt index 6994b4d..3e39880 100644 --- a/src/tools/idlc/CMakeLists.txt +++ b/src/tools/idlc/CMakeLists.txt @@ -55,7 +55,6 @@ install( install( TARGETS idlc - EXPORT "${CMAKE_PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT dev)