# Find CVB libraries via CMake

**URL:** https://forum.commonvisionblox.com/t/find-cvb-libraries-via-cmake/302
**Category:** C++ API
**Tags:** linux, cmake
**Created:** [December 12, 2017, 9:52am UTC](https://forum.commonvisionblox.com/t/find-cvb-libraries-via-cmake/302 "2017-12-12T09:52:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bjornholmberg](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@bjornholmberg](https://forum.commonvisionblox.com/u/bjornholmberg)
#### Post date: [December 12, 2017, 9:52am UTC](https://forum.commonvisionblox.com/t/find-cvb-libraries-via-cmake/302/1 "2017-12-12T09:52:57Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Andreas](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/andreas/32/75_2.png) [@Andreas](https://forum.commonvisionblox.com/u/Andreas)
#### Post date: [December 12, 2017, 11:42am UTC](https://forum.commonvisionblox.com/t/find-cvb-libraries-via-cmake/302/2 "2017-12-12T11:42:15Z")

</div>

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.

```auto
# 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.

```auto
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.

---

<div class="post-metadata">

### Author: ![bjornholmberg](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@bjornholmberg](https://forum.commonvisionblox.com/u/bjornholmberg)
#### Post date: [December 13, 2017, 10:39am UTC](https://forum.commonvisionblox.com/t/find-cvb-libraries-via-cmake/302/3 "2017-12-13T10:39:44Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![parsd](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/parsd/32/7_2.png) [@parsd](https://forum.commonvisionblox.com/u/parsd)
#### Post date: [December 21, 2017, 12:25pm UTC](https://forum.commonvisionblox.com/t/find-cvb-libraries-via-cmake/302/4 "2017-12-21T12:25:52Z")

</div>

A post was merged into an existing topic: [Trigger camera on PTP Timestamp Modulo Event](https://forum.commonvisionblox.com/t/trigger-camera-on-ptp-timestamp-modulo-event/311)
