On 06/07/2011 03:38 PM, Bjørn Forsman wrote: > Thanks for a quick reply! > > On 7 June 2011 14:52, Michael Wild <them...@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
And if it is used in multiple subdirectories? FindXXX.cmake modules should only do the minimum, i.e. finding the required libraries and include-directories, setting XXX_FOUND, XXX_INCLUDE_DIRS and XXX_LIBRARIES. Anything more complex, e.g. calling add_definitions(), include_directories(), function(), macro() etc. should go into a UseXXX.cmake module. If you find a FindXXX.cmake module that calls add_definitions(), include_directories(), link_libraries() or some such, it is broken and needs to be fixed. Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake