[CMake] Using Qt5 with cmake
Alexander Neundorf
a.neundorf-work at gmx.net
Fri Jan 18 13:38:22 EST 2013
On Friday 18 January 2013, Bogdan Cristea wrote:
> Le vendredi 18 janvier 2013 à 15:22 +0000, Laszlo Papp a écrit :
> > What is wrong about Stephen's post? It has been working for me in
> > several projects.
>
> A line like this
>
> find_package(Qt5Declarative)
>
> generates a warning about missing FindQt5Declarative.cmake which is not
> provided by Qt5 nor cmake. Maybe I am missing something, but I am not
> able to use Qt5 with cmake following that post.
It should also warn you that you used neither the MODULE nor the NO_MODULE
option (if your cmake is recent enough).
When using find_package() like you do, it first searches for a
FindQt5Decl.cmake, and if it doesn't find one, it continues to search for a
Qt5DeclConfig.cmake in a bunch of directories.
Qt5 installs Config.cmake files, so you should use
find_package(Qt5Decl CONFIG)
or
find_package(Qt5Decl NO_MODULE)
to make obvious what you are searching for.
So, it seems cmake did not find a Qt5DeclarativeConfig.cmake nor a
Qt5Declarative-config.cmake file on your system.
Does such a file exist ?
If yes, you need to adjust the environment variable CMAKE_PREFIX_PATH to point
to the install prefix of Qt5.
Alex
More information about the CMake
mailing list