diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index 3df410174fc..90f4514a779 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -222,7 +222,7 @@ macro(find_flann) if(PCL_ALL_IN_ONE_INSTALLER) set(FLANN_ROOT "${PCL_ROOT}/3rdParty/Flann") elseif(NOT FLANN_ROOT) - get_filename_component(FLANN_ROOT "@FLANN_INCLUDE_DIRS@" PATH) + set(FLANN_ROOT "@FLANN_ROOT@") endif() set(FLANN_USE_STATIC @FLANN_USE_STATIC@) diff --git a/cmake/Modules/FindFLANN.cmake b/cmake/Modules/FindFLANN.cmake index 97decc361ac..6e558446836 100644 --- a/cmake/Modules/FindFLANN.cmake +++ b/cmake/Modules/FindFLANN.cmake @@ -21,6 +21,7 @@ # :: # # FLANN_FOUND True in case FLANN is found, otherwise false +# FLANN_ROOT Path to the root of found FLANN installation # # Example usage # ^^^^^^^^^^^^^ @@ -45,6 +46,10 @@ if(flann_FOUND) else() set_property(TARGET FLANN::FLANN APPEND PROPERTY INTERFACE_LINK_LIBRARIES flann::flann_cpp) endif() + # Determine FLANN installation root based on the path to the processed Config file + get_filename_component(_config_dir "${flann_CONFIG}" DIRECTORY) + get_filename_component(FLANN_ROOT "${_config_dir}/../../.." ABSOLUTE) + unset(_config_dir) return() endif() @@ -136,4 +141,5 @@ if(FLANN_FOUND) endif() endif() endif() + get_filename_component(FLANN_ROOT "${FLANN_INCLUDE_DIR}" PATH) endif() diff --git a/cmake/pcl_all_in_one_installer.cmake b/cmake/pcl_all_in_one_installer.cmake index 718993466b9..039a21f093f 100644 --- a/cmake/pcl_all_in_one_installer.cmake +++ b/cmake/pcl_all_in_one_installer.cmake @@ -11,7 +11,6 @@ get_filename_component(BOOST_ROOT "${Boost_INCLUDE_DIR}" PATH) get_filename_component(BOOST_ROOT "${BOOST_ROOT}" PATH) get_filename_component(EIGEN_ROOT "${EIGEN_INCLUDE_DIRS}" PATH) get_filename_component(QHULL_ROOT "${QHULL_INCLUDE_DIRS}" PATH) -get_filename_component(FLANN_ROOT "${FLANN_INCLUDE_DIRS}" PATH) get_filename_component(VTK_ROOT "${VTK_DIR}" PATH) get_filename_component(VTK_ROOT "${VTK_ROOT}" PATH) get_filename_component(VTK_ROOT "${VTK_ROOT}" PATH)