[Development] Installing Qt5Config.cmake from the Qt repo?

Stephen Kelly stephen.kelly at kdab.com
Wed Nov 2 16:03:51 CET 2011


On Wednesday, November 02, 2011 15:06:29 you wrote:

> Being able to just state "my target Foo uses packages Bar and Blub" is
> already since quite some time on the TODO for cmake, i.e. so that Foo will
> then link against Bar and Blub, and also get the include directories for
> Bar and Blub (and probably also necessary macros).
> 
> I'd say this shouldn't be pushed into a Qt5Config.cmake, but we should use
> what will be in cmake (and if possible help with getting it into cmake).
> 

I imagined something like this:
macro(qt5_add_module _target _modulename)
    find_package(Qt5${_modulename})
    target_link_libraries(${_target} ${Qt5${_modulename}_LIBRARY})
    # Warning: Imaginary cmake command:
    target_include_directories(${_target} ${Qt5${_modulename}_INCLUDE_DIRS})
    set_target_properties(${_target}
        PROPERTIES COMPILE_FLAGS ${Qt5${_modulename}_DEFINITIONS})
endmacro()

If cmake in the future gets something for doing that all in one go, fair 
enough, but it's not a blocker at any rate.

<snip>

> > 
> > The easiest way is set(CMAKE_AUTOMOC ON), which will work for Qt5 in
> > CMake 2.8.7 (cmake 2.8.6 checks for Qt4).
> 
> Yes. CMake will need a small modification to support Qt5 too, but if the
> behaviour of moc stays the same this will be simply to not only check for
> QT4_FOUND, but also QT5_FOUND.
> 

See the qt5_automoc branch in cmake stage.

Thanks,

-- 
Stephen Kelly <stephen at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111102/a53f711c/attachment.sig>


More information about the Development mailing list