Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link-type keywords in linked libraries in "PCLConfig.cmake" with CMake >= 3.11 #3341

Merged
merged 2 commits into from
Sep 14, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
else(CMAKE_VERSION VERSION_LESS 3.11)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be elseif?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks for noticing and sorry for the noise, fixed in 0801d26, let me know if the rest of the PR seems ok so I can rebase it in the parent commit.

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