I have a quick question about the FIND_PACKAGE
function in CMake. I have a project which utilizes the point cloud library (PCL). PCL depends on Boost, and my project does as well. So, at the top of my CMakeLists.txt I have the following:
FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options)
# Preserve project Boost required libraries
SET(Boost_PROJECT_LIBRARIES ${Boost_LIBRARIES})
FIND_PACKAGE(PCL 1.6 REQUIRED COMPONENTS common search)
My project utilizes the Boost.program_options library, and PCL needs several others. When FIND_PACKAGE(PCL ...)
is run, it overwrites the previous ${Boost_LIBRARIES}
with its own required libraries. I came up with a work around to save the Boost libraries needed by my project and then find the PCL package.
My question for the CMake gurus is there a better way to handle this sort of thing in CMake? Or, is this possibly a bug in either the FindBoost.cmake or FindPCL.cmake modules?
FindPCL.cmake
module. Again, just my experience. – Seddafind_package
-option changed between twofind_package
commands (like setting BOOST_ROOT or something), then I think you're right - it is a bug – Division