# Problem in Setting up QT to Integrate with OpenCV and C++ in Ubuntu 18.04 using CMake

**URL:** https://discourse.cmake.org/t/problem-in-setting-up-qt-to-integrate-with-opencv-and-c-in-ubuntu-18-04-using-cmake/786
**Category:** Usage
**Tags:** os:linux, comp:gcc
**Created:** [March 10, 2020, 9:08pm UTC](https://discourse.cmake.org/t/problem-in-setting-up-qt-to-integrate-with-opencv-and-c-in-ubuntu-18-04-using-cmake/786 "2020-03-10T21:08:39Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![ferdnyc](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ferdnyc/32/267_2.png) [@ferdnyc](https://discourse.cmake.org/u/ferdnyc)
#### Post date: [March 17, 2020, 9:51pm UTC](https://discourse.cmake.org/t/problem-in-setting-up-qt-to-integrate-with-opencv-and-c-in-ubuntu-18-04-using-cmake/786/3 "2020-03-17T21:51:42Z")

</div>

> [@raisa](#):
>
> I read about explicit path definition for Qt integration instead of just putting " **WITH\_QT=ON**". So I decided to go with **cmake-gui** and defined each path for Qt path configuration. Like this :
> 
> ```auto
> WITH_QT=ON (checked in cmake-gui)
> Qt5Concurrent_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Concurrent
> Qt5Core_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Core
> Qt5Gui_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Gui
> Qt5OpenGL_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5OpenGL
> Qt5Test_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Test
> Qt5Widgets_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Widgets
> Qt5_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5
> 
> ```

Also, those seem wrong to me. Those aren’t the locations of the _Qt_ components, they’re the locations of the CMake configuration files that _configure_ the Qt components — but they’ll be thrown off with those paths (if they’re even run at all). The right variables would be something _like_…

```auto
Qt5Concurrent_DIR = /home/raisa/Qt5.9.9/5.9.9/

```

or…

```auto
Qt5Core_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/

```

(Most likely the same path for all of the components, since they’re all ultimately installed in the same dir.)

But you shouldn’t need to do that, if CMake is in charge, and if you’re using a system Qt (installed by `sudo apt`). CMake will pick up the pieces for those automatically, they’re in default locations. (As long as you have `-dev` packages installed.)

If things aren’t working, it’s best to post as much of your actual `CMakeLists.txt` contents as could be relevant, from tiny snippets it’s hard to say what could be an issue. Posting actual output of the `cmake` generation run also helps.

---

_[View the full topic](https://discourse.cmake.org/t/problem-in-setting-up-qt-to-integrate-with-opencv-and-c-in-ubuntu-18-04-using-cmake/786)._
