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

Modernize cmake config template #6235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lesc-hexagon
Copy link

The helper strings was not updated for 14 year and the mentioned Targets do not seem to exist.

Update to use modern style.

PCLConfig.cmake.in Outdated Show resolved Hide resolved
@larshg
Copy link
Contributor

larshg commented Feb 18, 2025

With my current test, PCL_INCLUDE_DIRS and PCL_LIBRARY_DIRS are populated with:

[CMake] PCL_INCLUDE_DIRS are C:/dev/pcl/out/install/x64-Release/include/pcl-1.14;C:/dev/vcpkg/installed/x64-windows/include/eigen3
[CMake] PCL_LIBRARY_DIRS are C:/dev/pcl/out/install/x64-Release/lib

So maybe we can keep them as optional and indeed add the modern way as the primary approach.

The values should be populated from the CONFIG script, at least with the root directory of PCL?

# check whether PCLConfig.cmake is found into a PCL installation or in a build tree
if(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
  # Found a PCL installation
  # pcl_message("Found a PCL installation")
  set(PCL_CONF_INCLUDE_DIR "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
  set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib")
elseif(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h")
  # Found a non-standard (likely ANDROID) PCL installation
  # pcl_message("Found a PCL installation")
  set(PCL_CONF_INCLUDE_DIR "${PCL_ROOT}/include")
  set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib")
elseif(EXISTS "${PCL_DIR}/include/pcl/pcl_config.h")
  # Found PCLConfig.cmake in a build tree of PCL
  # pcl_message("PCL found into a build tree.")
  set(PCL_CONF_INCLUDE_DIR "${PCL_DIR}/include") # for pcl_config.h
  set(PCL_LIBRARY_DIRS "${PCL_DIR}/lib")
else()
  pcl_report_not_found("PCL can not be found on this machine")
endif()

set(PCL_INCLUDE_DIRS "${PCL_CONF_INCLUDE_DIR}")

@lesc-hexagon
Copy link
Author

With my current test, PCL_INCLUDE_DIRS and PCL_LIBRARY_DIRS are populated with:

You are probably right, my description is probably false. I think we tried to link against the Components specific Variables. Which do not exist for all Components or something.
We probably got confused as the doc said to search for components specifically and then link to a global target.
None the less I think the new way linking against the target would be preferable. But I just thought I propose the update we found working for us. I have not invested much time to understand you full cmake.

The helper strings was not updated for 14 year and the mentioned Targets do not seem to exist.

Update to use modern style.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants