> -----Original Message----- > From: Development <development-boun...@qt-project.org> On Behalf Of > Thiago Macieira > Sent: Wednesday 13 February 2019 16:36 > To: development@qt-project.org > Subject: Re: [Development] CMake Workshop Summary > > On Wednesday, 13 February 2019 05:58:18 PST Kevin Funk via Development > wrote: > > The problem is, besides the reasons Simon mentioned, that just using > > "Qt" as the package prefix will make it more difficult for distros to > > co-install the CMake config files for different Qt versions. > > > > Still all up for discussions though. Happy to get more people involved. > > Is it possible to use Qt6 and make the system export "Qt::" as an alias, > possibly behind an extra option passed in find_package()?
I think Kevin was talking about the cmake package file names. > If an alias is not > possible, is it possible to make find_package() set variables like ${QTCORE} > that will be either Qt5::Core or Qt6::Core, depending on the one found? The problem with variables is they can be empty and it is not an error condition: # CMake issues no error: target_link_libraries(mything PRIVATE ${OOPS_SOMETHING_WAS_NOT_FOUND} ${OOPS_TYPO} ) Eg if you write this: find_package(Qt6) target_link_libraries(mything PRIVATE ${QtCore_LIBRARY} ${QTCore_LIBRARY} ${QtCore_LIBRARIES} # etc ) Cmake will issue no error even if Qt6 is not found. CMake treats explicitly written targets with '::' in their name in a special way. It ensures that they exist # CMake errors if the Qt5::Core target is not available (either because # someone wrote a typo, or because someone forgot to call # find_package(), or the find_package() call is there but Qt5 # was not found) target_link_libraries(mything PRIVATE Qt5::Core) Of course it is easy to create a `Qt5or6::Core` target for transitional use and get all the benefits. target_link_libraries(mything PRIVATE Qt5or6::Core) Thanks, Stephen. > > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel System Software Products > > > > _______________________________________________ > Development mailing list > Development@qt-project.org > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists. > qt- > project.org%2Flistinfo%2Fdevelopment&data=02%7C01%7Cstkelly%40 > microsoft.com%7Ce621428df88a451491a908d691d18d1a%7C72f988bf86f141 > af91ab2d7cd011db47%7C1%7C0%7C636856726536013190&sdata=UwtI > yJIQOkx%2FVpXirw6yFeUqoQOaYGC3oOUrlNNZ4O4%3D&reserved=0 _______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development