From 0bf9627036a93de0bf74afb5d082da44ac07d3e8 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Thu, 28 Mar 2024 13:03:46 +0100 Subject: [PATCH] Always make idlc_generate available in install With cross-builds, and now therefore also static builds, one does need IDLC. Installing Generate.cmake unconditionally means one can always write idlc_generate(TARGET konijn FILES wortel.idl) and one only has to make sure that CMake can find "idlc" and the backend library. Adding the host build to the CMAKE_PREFIX_PATH as in: cmake -DCMAKE_PREFIX_PATH=.../target-install\;.../host-install results in CMake finding the CycloneDDS package for the target in the target-install directory while also looking (and finding) idlc and the backend somewhere in the host-install directory. Signed-off-by: Erik Boasson --- CMakeLists.txt | 4 ++++ PackageConfig.cmake.in | 4 +--- src/tools/idlc/CMakeLists.txt | 5 ----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa04d62b6d..eb7e2e0d6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,6 +343,10 @@ install( DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT dev ) +install( + FILES "${CycloneDDS_SOURCE_DIR}/cmake/Modules/Generate.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/idlc" + COMPONENT dev) # Generated file paths # although the following files are generated, they are checked into source diff --git a/PackageConfig.cmake.in b/PackageConfig.cmake.in index 8c8fbb7e5a..25aaaf265d 100644 --- a/PackageConfig.cmake.in +++ b/PackageConfig.cmake.in @@ -12,6 +12,4 @@ @PACKAGE_INIT@ 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/src/tools/idlc/CMakeLists.txt b/src/tools/idlc/CMakeLists.txt index 7134fa1d20..576dd014e7 100644 --- a/src/tools/idlc/CMakeLists.txt +++ b/src/tools/idlc/CMakeLists.txt @@ -114,11 +114,6 @@ if (INSTALL_PDB) ) endif() -install( - FILES "${CycloneDDS_SOURCE_DIR}/cmake/Modules/Generate.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/idlc" - COMPONENT dev) - include("${CycloneDDS_SOURCE_DIR}/cmake/Modules/Generate.cmake") if(BUILD_TESTING)