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

Stephen Kelly stephen.kelly at kdab.com
Wed Nov 2 11:26:10 CET 2011


On Wednesday, November 02, 2011 11:17:31 Thiago Macieira wrote:
> On Wednesday, 2 de November de 2011 11:09:36 Stephen Kelly wrote:
> > On Tuesday, November 01, 2011 17:03:22 Thiago Macieira wrote:
> > > On Tuesday, 1 de November de 2011 15:58:10 Stephen Kelly wrote:
> > > > It is completely granular. Qt5Config.cmake and Qt5Use.cmake are
> > > > just
> > > > simple aggregators as discussed.
> > > 
> > > If you have one project per CMakeLists.txt file, yeah, it's useful.
> > > 
> > > If you have more than project with different requirements, you need
> > > to do it differently.
> > 
> > I also don't understand this email.
> 
> Consider the following:
> 
> project(MyLib)
> find_target(Qt5 REQUIRED QtCore QtGui QtDeclarative QtTest)
> include(${Qt5Core_USE_FILE})
> include(${Qt5Gui_USE_FILE})
> include(${Qt5Declarative_USE_FILE})
> 
> add_library(mylib SHARED ${mylib_SRCS})
> target_link_libraries(mylib
>     ${Qt5Core_LIBRARY}
>     ${Qt5Gui_LIBRARY}
>     ${Qt5Declarative_LIBRARY}
> )

include_directories(${Qt5Test_INCLUDE_DIRS})

or 

include(${Qt5Declarative_USE_FILE})

> 
> add_executable(tst_mylib NOGUI ${tst_mylib_SRC})
> target_link_libraries(mylib
>     ${Qt5Core_LIBRARY}
>     ${Qt5Gui_LIBRARY}
>     ${Qt5Declarative_LIBRARY}
>     ${Qt5Test_LIBRARY}
> )
> 
> The test does not compile because there is no -I$QTDIR/include/QtTest. How
> do I tell it to include those headers *only* when compiling the test, not
> when compiling the library?

You add the line I just added above in between.

The use file is a convenience that is relatively common in cmake modules that 
adds includes and definitions etc, but the more direct way is also possible.

If the test is in a different directory with its own CMakeLists file it's also 
easier.

So I don't think the Qt5Config.cmake presents any new issues.

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/bb62b442/attachment.sig>


More information about the Development mailing list