[CMake] FindQt4.cmake to automatically include QT_USE_FILE?

Bjørn Forsman bjorn.forsman at gmail.com
Tue Jun 7 09:38:49 EDT 2011


Thanks for a quick reply!

On 7 June 2011 14:52, Michael Wild <themiwi at gmail.com> wrote:
> On 06/07/2011 02:20 PM, Bjørn Forsman wrote:
>> As far as I can tell, all Qt programs built with CMake must include
>> QT_USE_FILE after find_package(). So why doesn't FindQt4.cmake simply
>> include QT_USE_FILE itself? Is there maybe a use case where
>> QT_USE_FILE is *not* wanted?
>
> If you don't care for the macros and want to set up the
> include-directories and defines yourself, no.

Ok, guess I haven't had any use for that so far. Examples of when it
may be useful are welcome.

But, wait...isn't that the whole point of find_package()? To set up
variables containing necessary includes and libs? It seems
FindWt4.cmake is special in this case, needing one extra step.

> Also, it is common to
> find_package(Qt4) in the top-level CMakeLists.txt file, but then include
> QT_USE_FILE only in specific subdirectories, where Qt is actually used.

Why not put find_package(Qt4) in the sub directories where it is actually used?

Best regards,
Bjørn Forsman


More information about the CMake mailing list