vcpkg/ports/pcl/use_target_link_libraries_in_pclconfig.patch

32 lines
1.5 KiB
Diff

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