[CMake] Finding Qt4 binaries under Windows

Sebastian Schuberth sschuberth at gmail.com
Tue Sep 8 10:01:14 EDT 2009


On 05.09.2009 18:49, Alexander Neundorf wrote:

>> But just for the fun of it, I also tried Pau's
>>
>> find_package(Qt4 PATHS "C:/Qt/4.5.1")
>
> If you use PATHS, cmake looks for a Qt4Config.cmake file, which does not
> exist. So don't use PATHS or HINTS, just do:
>
> find_package(Qt4)  (maybe add the REQUIRED keyword).
>
> This will load FindQt4.cmake.
> FindQt4.cmake then tries to find qmake.
> This is where you can help.

Thanks a lot, Alex, that finally was a helpful answer!

FYI, in a batch file I'm now doing:

---8<---

: Search QTDIR first, then some guessed paths.
set CMAKE_PREFIX_PATH=%QTDIR%;C:\Qt\4.5.2;C:\Qt\4.5.1;C:\Qt\4.5.0;%CMAKE_PREFIX_PATH%

: Generate the project files in the output directory.
pushd VS2008-Win32
cmake -G "Visual Studio 9 2008" ..
if errorlevel 1 pause
popd

---8<---

CMake would search QTDIR itself, but only *after* CMAKE_PREFIX_PATH, which is why I made QTDIR the first path in CMAKE_PREFIX_PATH. This now seems to work how I would like it to work.

Thanks again.

-- 
Sebastian Schuberth



More information about the CMake mailing list