From 4badff3a195937014e3fdb8a3cfede96d8be136e Mon Sep 17 00:00:00 2001 From: Kai Wang Date: Sat, 15 Aug 2026 15:04:07 +0800 Subject: [PATCH 1/2] Add namespaced alias targets PCL:: to PCLConfig.cmake Downstream projects can now link e.g. PCL::common or PCL::geometry. An ALIAS of a non-global imported target requires CMake >= 3.18, so emulate it with an INTERFACE IMPORTED wrapper for older versions. Fixes #6397 --- PCLConfig.cmake.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index 4dd18517e85..8497f372595 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -704,6 +704,15 @@ foreach(component ${PCL_TO_FIND_COMPONENTS}) add_library(${pcl_component} INTERFACE IMPORTED) endif() + # Namespaced alias targets, e.g. PCL::common. An ALIAS of a non-global + # imported target requires CMake >= 3.18, so emulate it for older versions. + if(CMAKE_VERSION VERSION_LESS 3.18.0) + add_library(PCL::${component} INTERFACE IMPORTED) + target_link_libraries(PCL::${component} INTERFACE ${pcl_component}) + else() + add_library(PCL::${component} ALIAS ${pcl_component}) + endif() + foreach(def ${PCL_DEFINITIONS}) string(REPLACE " " ";" def2 ${def}) string(REGEX REPLACE "^-D" "" def3 "${def2}") From e2a65c8a2db4491471e50bab8fa7160c70031ace Mon Sep 17 00:00:00 2001 From: Kai Wang Date: Tue, 18 Aug 2026 12:45:25 +0800 Subject: [PATCH 2/2] Add PCL::PCL target --- PCLConfig.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index 8497f372595..54b740d7643 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -758,6 +758,9 @@ endif() pcl_remove_duplicate_libraries(PCL_COMPONENTS PCL_LIBRARIES) +add_library(PCL::PCL INTERFACE IMPORTED) +target_link_libraries(PCL::PCL INTERFACE ${PCL_COMPONENTS}) + # Add 3rd party libraries, as user code might include our .HPP implementations list(APPEND PCL_LIBRARIES ${PCL_BOOST_LIBRARIES} ${PCL_OPENNI_LIBRARIES} ${PCL_OPENNI2_LIBRARIES} ${PCL_ENSENSO_LIBRARIES} ${PCL_davidSDK_LIBRARIES} ${PCL_DSSDK_LIBRARIES} ${PCL_RSSDK_LIBRARIES} ${PCL_RSSDK2_LIBRARIES} ${PCL_VTK_LIBRARIES}) if (TARGET FLANN::FLANN)