Skip to content
Advertisement

CMAKE_PREFIX_PATH for Qt5

I want to compile this which requires Qt 5.14 and I have Qt 5.12 installed from my linux repository.I just compiled Qt from source and installed it in /usr/local/Qt-6.0.0/(default location).
But CMake prints the following error although I’ve added set(CMAKE_PREFIX_PATH "/usr/local/Qt-6.0.0/include") and/or set(CMAKE_PREFIX_PATH "/usr/local/Qt-6.0.0/") :

JavaScript

Advertisement

Answer

Since it has solved your question, I am just going to put it as an answer here. I will improve this section more in detail later.

If you are using cmake use find_package to find the package and then link to your binary in later stage.

JavaScript

If you just want to find the Qt modules then just set the Qt5_DIR
ex: Qt5_DIR="/Users/bob/Qt/5.12.7/clang_64/lib/cmake/Qt5"

when building with CMake you can use Qt5_DIR or CMAKE_PREFIX_PATH, both should work.

More explanation about building with CMake can be found here

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement