cmake not prioritising user installation of FlyCapture2
Hello Chao,
After our yesterday's chat, I delved a little deeper into FindFlyCapture2.cmake. I saw that there should be a priority to the user installation of the library, which in fact you include inside the files of this repo.
However, each time I compile, I get the message
-- flycapture include dir found: /usr/include
-- flycapture library dir found: /usr/lib/
probably because I had already an active installation of PtGrey's SDK in my system.
I tried enforcing the local path by using the NO_DEFAULT_PATH option in the find_path and find_library commands, but it didn't seem to do anything.
In the end, I commented out all the conditional code and set the paths manually to local, e.g.
set(FlyCapture2_INCLUDE_DIR ${FlyCapture2_CHECK_INCLUDE_DIRS})
It's not a function-breaking bug, but it doesn't allow you to NOT use the system libraries for this package.
Looking forward to hearing what you think of this.
Remove your build folder and do it again? That might be a cmake cache issue.
After deleting catkin_ws/devel I ran catkin_make --pkg flea3.
Snippet of the result is:
-- ==> add_subdirectory(flea3)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- flycapture include dir found: /usr/include
-- flycapture library dir found: /usr/lib/
-- Found FlyCapture2: /usr/include
From what I get, it wasn't a cache issue.
did you also delete the build folder?
I hadn't previously. Did now. Same result.
Do you want me to provide you with some output for bug tracking?
I tried myself, got the same result. For now you can just add NO_DEFAULT_PATH to find_path call in FindFlyCapture2.cmake to force local flycapture
Thanks for confirming it. I tried NO_DEFAULT_PATH and it doesn't seem to do anything, but I don't believe it's your fault.
I worked around find_path and used the current path to assign the library directory.
get_filename_component(FLYCAPTURE_DIR ${CMAKE_CURRENT_SOURCE_DIR} REALPATH)
list(APPEND FlyCapture2_CHECK_INCLUDE_DIRS
${FLYCAPTURE_DIR}/flycapture/include
)