Skip to content

Commit

Permalink
[pcl] Fix problem with link-type keywords in linked libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Sep 12, 2019
1 parent c85d63b commit e71cc9e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ports/pcl/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: pcl
Version: 1.9.1-8
Version: 1.9.1-9
Homepage: https://github.com/PointCloudLibrary/pcl
Description: Point Cloud Library (PCL) is open source library for 2D/3D image and point cloud processing.
Build-Depends: eigen3, flann, qhull, vtk, libpng, boost-system, boost-filesystem, boost-thread, boost-date-time, boost-iostreams, boost-random, boost-foreach, boost-dynamic-bitset, boost-property-map, boost-graph, boost-multi-array, boost-signals2, boost-ptr-container, boost-uuid, boost-interprocess, boost-asio
Expand Down
2 changes: 2 additions & 0 deletions ports/pcl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ vcpkg_from_github(
use_flann_targets.patch
boost-1.70.patch
cuda_10_1.patch
# Patch for https://github.com/microsoft/vcpkg/issues/7660
use_target_link_libraries_in_pclconfig.patch
)

file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindFLANN.cmake)
Expand Down
31 changes: 31 additions & 0 deletions ports/pcl/use_target_link_libraries_in_pclconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in
index f1c2ca5..d28cb63 100644
--- a/PCLConfig.cmake.in
+++ b/PCLConfig.cmake.in
@@ -609,7 +609,7 @@ foreach(component ${PCL_TO_FIND_COMPONENTS})
INTERFACE_INCLUDE_DIRECTORIES "${PCL_${COMPONENT}_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${PCL_${COMPONENT}_LINK_LIBRARIES}"
)
- else()
+ elseif(CMAKE_VERSION VERSION_LESS 3.11)
set_target_properties(${pcl_component}
PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "${definitions}"
@@ -617,6 +617,17 @@ foreach(component ${PCL_TO_FIND_COMPONENTS})
INTERFACE_INCLUDE_DIRECTORIES "${PCL_${COMPONENT}_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${PCL_${COMPONENT}_LINK_LIBRARIES}"
)
+ else()
+ set_target_properties(${pcl_component}
+ PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS "${definitions}"
+ INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:CXX>:${PCL_COMPILE_OPTIONS}>"
+ INTERFACE_INCLUDE_DIRECTORIES "${PCL_${COMPONENT}_INCLUDE_DIRS}"
+ )
+ # If possible, we use target_link_libraries to avoid problems with link-type keywords,
+ # see https://github.com/PointCloudLibrary/pcl/issues/2989
+ # target_link_libraries on imported libraries is supported only since CMake 3.11
+ target_link_libraries(${pcl_component} INTERFACE ${PCL_${COMPONENT}_LINK_LIBRARIES})
endif()
set(PCL_${COMPONENT}_LIBRARIES ${pcl_component})
endif()

0 comments on commit e71cc9e

Please sign in to comment.