[CMake] Finding Qt4 binaries under Windows

Sebastian Schuberth sschuberth at gmail.com
Fri Aug 21 19:02:51 EDT 2009


On 21.08.2009 22:22, Michael Jackson wrote:

> YOU are the one who compiled it in C:\Qt\4.5.1 according to your
> original post. I am simply making you aware of the error.

Well, I specified "C:/Qt" instead of "C:/Qt/4.5.1" on purpose. The point 
is: I have compiled Qt myself, and not used the installer, thus there 
are no registry keys and qmake is not in my PATH. So it's clear that 
CMake cannot find my Qt installation without any hints from my side.
On the other hand, I want my CMakeLists.txt file to be as generic as 
possible, and not mention any version specific directories. As it's sort 
of common for people to have Qt installed beneath "C:/Qt" on Windows, I 
thought it might be possible to instruct find_package() to recursively 
search for Qt / qmake starting at "C:/Qt".

> So, if you compiled to C:\Qt\4.5.1 then you have a couple of options:
>
> set QTDIR to C:\Qt\4.5.1 in the environment variables.
>
> OR
>
> find_package(Qt4 PATHS "C:/Qt/4/.5.1") like Pau suggested.
>
> If you don't like the version number on there then recompile Qt 4.5.1 so
> that it has a path of C:\Qt and NOT C:\Qt\4.5.1
>
> Understand?

Yes, I perfectly understand, it's just not what I want, and I'm a little 
disappointed how limited find_package(Qt4) seems to be.

There is not need to recompile Qt in order to make it available at 
"C:/Qt" instead of "C:/Qt/4.5.1", I just would have to move the files. 
But like I said, the default install location for Qt on Windows is 
"C:/Qt/<version>", and this is what e.g. the PDB files expect when 
debugging Qt in Visual Studio.

But just for the fun of it, I also tried Pau's

find_package(Qt4 PATHS "C:/Qt/4.5.1")

which still gives me the

"Could not find a configuration file for package Qt4."

error.

-- 
Sebastian Schuberth



More information about the CMake mailing list