Find CVB libraries via CMake

I am using cmake to create make files for a rather complex project today. Is there a standard way of using cmake to find the CVB includes etc that is needed. Today my cmake pipeline does not find the FindCVB.cmake file in /opt/cvb/cmake. I could start to manually set things in the CMakeLists.txt file but i first I wonder if there is a standard way?

Hi,

the standard way to find CVB using cmake is shown in the tutorials (e.g. GrabConsole)
It uses the environment variable “CVB” which must exist on a valid installation.
Once the “FindCVB.cmake” script is in the module path you can simply ask CMake to find CVB.

# Make CMake aware of our FindCVB.cmake module
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "$ENV{CVB}/cmake")
find_package(CVB REQUIRED)

Please note it also takes care of the required include directories. For linking you can then pick the libraries needed. All dependencies to additional CVB libraries (in this case CVB::CVCImg) will automatically resolved.

target_link_libraries(GrabConsoleExample 
  CVB::CVCDriver 
  CVB::CVCUtilities 
  CVB::CVGenApi
)

By the way, this is not C++ specific and is also valid for the classic C API.

Hi Andreas,

Thanks for the answer! Works fine now.

Another question: I am using PTP sync on the cameras and would like to trigger each camera on a clock modululs event. Is there some instruction on how to achieve this?

A post was merged into an existing topic: Trigger camera on PTP Timestamp Modulo Event