Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH

I don't know a lot about cmake, I'm trying to build a client using cmake and Qt. Getting the following error:

CMake Error at alethzero/CMakeLists.txt:26 (find_package): By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5Widgets", but CMake did not find one.

Could not find a package configuration file provided by "Qt5Widgets" with any of the following names:


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

-- Configuring incomplete, errors occurred!

As far as I understand, I need to add the QT path to CMake. How do I do it? I have Qt installed in /home/user/Programs. All the explanations I find are "just do this or that". I need the exact Terminal commands so I can just learn how to do it in the future.


UPDATE: export CMAKE_PREFIX_PATH=/home/user/Programs did not help me.


This is documented:

The easiest way to use CMake is to set the CMAKE_PREFIX_PATH 
environment variable to the install prefix of Qt 5

Do this

export CMAKE_PREFIX_PATH=/home/user/Programs/<other_stuff>

where references the compiler etc, so that this complete path is valid:


Well, here you have a solution for Windows: How to find qt5 CMake module on windows

set (CMAKE_PREFIX_PATH "C:\\Qt\\Qt5.0.1\\5.0.1\\msvc2010\\")

For your environment, I think you will have to change the path where Qt is located...

Maybe this will help you:

I needed this on my macOS after Qt installation with brew install qt5:

export CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.7.0/

at an Ubuntu 16.04.4 LTS desktop the solution was

cmake .. -DMAKE_PREFIX_PATH=/usr/include/x86_64-linux-gnu/qt5

For ubuntu: cmake -DCMAKE_PREFIX_PATH=/home/ryan/Qt/5.11.2/gcc_64 ..

/home/ryan/Qt/ is the Qt installation root path

Need Your Help

Different ways of getting the EntityManager

java jpa entitymanager

The usual idiom I see for creating the EntityManager is something like this:

Python, Draw a circle with PIL

python python-imaging-library

I am looking for a command that will draw a circle on an existing image with PIL.