Skip to content

Commit

Permalink
Fix problem with link-type keywords in linked libraries in PCLC… (#3341)
Browse files Browse the repository at this point in the history
Fix problem with link-type keywords in linked libraries in PCLConfig.cmake with CMake >= 3.11
  • Loading branch information
traversaro authored and taketwo committed Sep 14, 2019
1 parent 102f389 commit 2e4cc61
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion PCLConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,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}"
Expand All @@ -628,6 +628,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()
Expand Down

0 comments on commit 2e4cc61

Please sign in to comment.