# OpenCV3 block with ci\_make\_app

**URL:** <https://discourse.libcinder.org/t/opencv3-block-with-ci-make-app/950>\
**Category:** Uncategorized\
**Created:** [November 14, 2017, 1:29pm UTC](https://discourse.libcinder.org/t/opencv3-block-with-ci-make-app/950 "2017-11-14T13:29:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghirigoro](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Ghirigoro](https://discourse.libcinder.org/u/Ghirigoro)\
**Post date:** [November 14, 2017, 1:29pm UTC](https://discourse.libcinder.org/t/opencv3-block-with-ci-make-app/950/1 "2017-11-14T13:29:05Z")

</div>

I’m trying to make a simple cmake based app with openCV with the following CMakeLists.txt:

```
    cmake_minimum_required(VERSION 3.8)
    set( CMAKE_VERBOSE_MAKEFILE ON )
    project(ritratto)

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

    get_filename_component( CINDER_PATH "~/Repositories/Cinder" ABSOLUTE )
    get_filename_component( APP_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE )

    include( ${CINDER_PATH}/proj/cmake/modules/cinderMakeApp.cmake )

    ci_make_app(
            APP_NAME "Ritratto"
            CINDER_PATH ${CINDER_PATH}
            SOURCES ${APP_PATH}/src/main.cpp
            INCLUDES ${APP_PATH}/include
            BLOCKS ${CINDER_PATH}/blocks/Cinder-OpenCV3
    ) 

```

But I get the following warning from CMake and the compiler fails to find OpenCV:

```
CMake Warning at /Users/mattia/Repositories/Cinder/proj/cmake/modules/cinderMakeApp.cmake:145 (find_package):
  Could not find a package configuration file provided by "Cinder-OpenCV3"
  with any of the following names:

    Cinder-OpenCV3Config.cmake
    cinder-opencv3-config.cmake

  Add the installation prefix of "Cinder-OpenCV3" to CMAKE_PREFIX_PATH or set
  "Cinder-OpenCV3_DIR" to a directory containing one of the above files. If
  "Cinder-OpenCV3" provides a separate development package or SDK, be sure it
  has been installed.

```

I tried adding another cinder block (Box2D) and that seemed to work fine, and I noticed that Box2D contained a cmake file while the OpenCV3 one did not. Is there something I’m doing wrong or is the OpenCV3 block not compatible with ci\_make\_app?

---

<div class="post-metadata">

**Author:** ![petros](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/petros/32/26_2.png) [@petros](https://discourse.libcinder.org/u/petros)\
**Post date:** [November 14, 2017, 6:49pm UTC](https://discourse.libcinder.org/t/opencv3-block-with-ci-make-app/950/2 "2017-11-14T18:49:16Z")

</div>

Hi @Ghirigoro

No, it doesn’t seem to have support for Cinder’s new CMake configuration. I have done it in the [past](https://github.com/PetrosKataras/Cinder-OpenCV3/blob/linux-project-files/samples/ocvBasic/linux/CMakeLists.txt) but things have changed completely since then.

In which platform are you trying to run this on?

If it is macOS or Linux you could probably get away by installing OpenCV3 systemwide and then using something like the following CMakeLists.txt for compiling the _ocvBasic_ sample:

```auto
cmake_minimum_required( VERSION 2.8 FATAL_ERROR )
set( CMAKE_VERBOSE_MAKEFILE ON )

project( ocvBasic )

get_filename_component( CINDER_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../" 
    
get_filename_component( APP_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../" ABSOLUTE )

include( "${CINDER_PATH}/proj/cmake/modules/cinderMakeApp.cmake" )

find_package( OpenCV 3 REQUIRED )

ci_make_app(
    SOURCES ${APP_PATH}/src/ocvBasicApp.cpp    
    INCLUDES ${APP_PATH}/../../../../include
    CINDER_PATH ${CINDER_PATH}
    LIBRARIES ${OpenCV_LIBS}
)

```

The paths assume that the CMakeLists.txt file is located under :

```auto
${CINDER_PATH}/blocks/Cinder-OpenCV3/samples/ocvBasic/proj/cmake

```

This is off the top of my head and untested but it should be the in right direction to get you started if interested.

Cheers,  
Petros

---

<div class="post-metadata">

**Author:** ![Ghirigoro](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@Ghirigoro](https://discourse.libcinder.org/u/Ghirigoro)\
**Post date:** [November 15, 2017, 11:58am UTC](https://discourse.libcinder.org/t/opencv3-block-with-ci-make-app/950/3 "2017-11-15T11:58:24Z")

</div>

That did the trick. Thanks so much.
