Qt and CMAKE_PREFIX_PATH

Started by
3 comments, last by BitMaster 9 years ago

Hi,

I'm using Qt with CMake and I have to write this line to have it working auto :

set(CMAKE_PREFIX_PATH C:/Qt/Qt5.4.1/5.4/msvc2013_64/lib/cmake/Qt5Widgets)

There is a way to avoid to have that ? This line has to be changed each time version change and is not portable.

Thanks for the help

Advertisement

You don't need to do that if you set an environment variable called QTDIR pointing to the Qt root directory.

And you need the bin directory in your PATH as well.

Then CMake should be happy.

<edit>

I have this: QTDIR=C:\Qt\5.4\msvc2013_64_opengl

and this added to PATH: C:\Qt\5.4\msvc2013_64_opengl\bin

<another_edit>

I believe that QTDIR is automatically set for you if you install the Qt dev package on Linux. I haven't had to set it, IIRC.

Too many projects; too much time

Works great, and portable now, thanks


I believe that QTDIR is automatically set for you if you install the Qt dev package on Linux. I haven't had to set it, IIRC.

I have to find the folder using Linux Mint and MacOSX.

I'm thinking moving the qt lib inside my third party folder and set the path on it in cmake script.

I don't have particular experience with Qt and CMake on Linux but in general library finding shenanigans are mostly a Windows-only thing because there is no sufficient standard where to search for libraries.

That said, Qt's CMake support is pretty good, especially when you compare it to some of the other libraries. Point CMake to one of the Qt CMake scripts and everything from there on works fine. Pasting a single directory into CMake when you set up is hardly a dealbreaker (especially since it usually happens exactly once per developer).

This topic is closed to new replies.

Advertisement