@@ -268,7 +268,7 @@ endmacro()
268268# `--> component is induced ==> warn and remove it
269269# from the list
270270
271- macro (find_external_library _component _lib _is_optional)
271+ function (find_external_library _component _lib _is_optional)
272272 if ("${_lib} " STREQUAL "boost" )
273273 find_boost()
274274 elseif ("${_lib} " STREQUAL "eigen" )
@@ -299,13 +299,20 @@ macro(find_external_library _component _lib _is_optional)
299299 find_glew()
300300 elseif ("${_lib} " STREQUAL "opengl" )
301301 find_package (OpenGL)
302+ elseif ("${_lib} " STREQUAL "pcap" )
303+ find_package (Pcap)
304+ elseif ("${_lib} " STREQUAL "png" )
305+ find_package (PNG)
306+ else ()
307+ message (WARNING "${_lib} is not handled by find_external_library" )
302308 endif ()
303309
304310 string (TOUPPER "${_component} " COMPONENT )
305311 string (TOUPPER "${_lib} " LIB)
306312 string (REGEX REPLACE "[.-]" "_" LIB ${LIB} )
307313 if (${LIB} _FOUND)
308314 list (APPEND PCL_${COMPONENT} _INCLUDE_DIRS ${${LIB} _INCLUDE_DIRS})
315+ set (PCL_${COMPONENT} _INCLUDE_DIRS ${PCL_${COMPONENT} _INCLUDE_DIRS} PARENT_SCOPE)
309316
310317 if (${LIB} MATCHES "VTK" )
311318 if (${${LIB} _VERSION_MAJOR} GREATER_EQUAL 9)
@@ -317,12 +324,16 @@ macro(find_external_library _component _lib _is_optional)
317324 include (${${LIB} _USE_FILE})
318325 else ()
319326 list (APPEND PCL_${COMPONENT} _LIBRARY_DIRS "${${LIB} _LIBRARY_DIRS}" )
327+ set (PCL_${COMPONENT} _LIBRARY_DIRS ${PCL_${COMPONENT} _LIBRARY_DIRS} PARENT_SCOPE)
320328 endif ()
321329 if (${LIB} _LIBRARIES)
322330 list (APPEND PCL_${COMPONENT} _LINK_LIBRARIES "${${LIB} _LIBRARIES}" )
331+ set (PCL_${COMPONENT} _LINK_LIBRARIES ${PCL_${COMPONENT} _LINK_LIBRARIES} PARENT_SCOPE)
332+ set (PCL_${LIB} _LIBRARIES ${${LIB} _LIBRARIES} PARENT_SCOPE) # Later appended to PCL_LIBRARIES
323333 endif ()
324334 if (${LIB} _DEFINITIONS AND NOT ${LIB} STREQUAL "VTK" )
325335 list (APPEND PCL_${COMPONENT} _DEFINITIONS ${${LIB} _DEFINITIONS})
336+ set (PCL_${COMPONENT} _DEFINITIONS ${PCL_${COMPONENT} _DEFINITIONS} PARENT_SCOPE)
326337 endif ()
327338 else ()
328339 if ("${_is_optional} " STREQUAL "OPTIONAL" )
@@ -339,7 +350,7 @@ macro(find_external_library _component _lib _is_optional)
339350 endif ()
340351 endif ()
341352 endif ()
342- endmacro ()
353+ endfunction ()
343354
344355macro (pcl_check_external_dependency _component)
345356endmacro ()
@@ -658,7 +669,7 @@ endif()
658669pcl_remove_duplicate_libraries(PCL_COMPONENTS PCL_LIBRARIES)
659670
660671# Add 3rd party libraries, as user code might include our .HPP implementations
661- list (APPEND PCL_LIBRARIES ${BOOST_LIBRARIES } ${OPENNI_LIBRARIES } ${OPENNI2_LIBRARIES } ${ENSENSO_LIBRARIES } ${davidSDK_LIBRARIES } ${DSSDK_LIBRARIES } ${RSSDK_LIBRARIES } ${RSSDK2_LIBRARIES } ${VTK_LIBRARIES } )
672+ list (APPEND PCL_LIBRARIES ${PCL_BOOST_LIBRARIES } ${PCL_OPENNI_LIBRARIES } ${PCL_OPENNI2_LIBRARIES } ${PCL_ENSENSO_LIBRARIES } ${PCL_davidSDK_LIBRARIES } ${PCL_DSSDK_LIBRARIES } ${PCL_RSSDK_LIBRARIES } ${PCL_RSSDK2_LIBRARIES } ${PCL_VTK_LIBRARIES } )
662673if (TARGET FLANN::FLANN)
663674 list (APPEND PCL_LIBRARIES FLANN::FLANN)
664675endif ()
0 commit comments