[pcl] Fix problem with link-type keywords in linked libraries (#8154)

Fix https://github.com/microsoft/vcpkg/issues/7660
This commit is contained in:
Silvio Traversaro 2019-09-12 19:06:11 +02:00 committed by Curtis J Bezault
parent 98c188c347
commit ecfc714b9a
3 changed files with 34 additions and 1 deletions

View File

@ -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

View File

@ -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)

View File

@ -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()