[Development] Problem finding the ToolsDependencies.cmake files - why without search paths?
Alexandru Croitor
alexandru.croitor at qt.io
Mon Dec 9 10:58:28 CET 2024
Hi,
> But how are the ToolsDependencies.cmake files supposed to be found, i.e. why are there no extra paths given ?
Usually by calling delegating the lookup of the Tools packages to the Qt6 package.
E.g.
find_package(Qt6 COMPONENTS FooTools)
But I don't recall if the _DIR / HINTS / PATHS case will work for that case.
CMAKE_PREFIX_PATH is the 100% work-everytime case.
> On 7. Dec 2024, at 13:35, Alexander Neundorf <neundorf at kde.org> wrote:
>
> On Donnerstag, 5. Dezember 2024 23:17:27 MEZ Alexander Neundorf wrote:
> > Hi,
> >
> > when searching Qt6 in a non-standard location, when using CMAKE_PREFIX_PATH
> > it is found properly.
> > When not using CMAKE_PREFIX_PATH, but HINTS, it fails because the
> > ToolsConfig.cmake files are not found.
> > This seems to be because here
> > https://github.com/qt/qtbase/blob/dev/cmake/QtModuleToolsDependencies.cmake.
> > in[1] no extra search paths are given to the find_dependency() call.
> >
> > When adding (for testing) the same search paths as here:
> > https://github.com/qt/qtbase/blob/dev/cmake/QtModuleDependencies.cmake.in[2]
> > the ToolsDependencies.cmake files are found.
> >
> > I understand this behaviour. But how are the ToolsDependencies.cmake files
> > supposed to be found, i.e. why are there no extra paths given ?
>
> So that's this bug ?
> https://bugreports.qt.io/browse/QTBUG-97615
It's related, but it's not /exactly/ your case I think.
> i.e. to avoid that cmake finds target-system executables when cross compiling ?
Not really target executables, but target libraries, so they are not accidentally linked into host apps / libs.
> How about only avoiding the search paths when cross compiling, but using them when not cross compiling ?
That sounds like it might be sensible compromise.
> Or should I ask that in the ticket ?
I would suggest creating a new issue with the exact details on how you configure, the exact find_package call you expect to work, and the reasoning why you expect it to work.
And linking it to the other ticket.
More information about the Development
mailing list