[cmake-developers] Installing Toolchain files (Was: Building with Qt for the Raspberry Pi with CMake)
Alexander Neundorf
neundorf at kde.org
Mon Apr 15 15:30:16 EDT 2013
On Monday 15 April 2013, Stephen Kelly wrote:
> Alexander Neundorf wrote:
> > I think that's a good idea.
> > Qt, once built, knows where the compiler is and what the target operating
> > system is, so it is a good source of information for that.
> > It also knows at least some part of CMAKE_FIND_ROOT_PATH, that would be
> > its own install locations, maybe it knows even more about where things
> > are to be found for the target ?
>
> I've uploaded the change I've worked on for Qt:
>
> https://codereview.qt-project.org/#change,53858
>
> The CMAKE_FIND_ROOT_PATH is indeed known, as is the CMAKE_PREFIX_PATH and
> all relevant compilers. That seems to be all the relevant information for a
> toolchain.
Mostly. CMAKE_FIND_ROOT_PATH can also contain additional user-specific
directories, but I guess it's ok.
It's actually great, since this should make cross-compiling with Qt much
easier :-)
> I tried also defining CMAKE_AR and CMAKE_LINKER, but that fails
> and is not needed anyway. Setting CMAKE_LINKER fails because the variable
> contains 'g++' and the '+' cause regex compile failure in
> CMakeParseImplicitLinkInfo.cmake.
>
> So, after building Qt, a project can be built using
>
> cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/qt/cmake/Qt5Toolchain.cmake
>
> The generated file is deliberately named generically so that that always
> works. The path to the Qt build will be specific enough anyway. The
> toolchain files contain absolute paths to the sysroot and the cross-
> compilers.
>
> When building Qt, a sysroot can be passed to the configure script, and a
> so- called 'host-prefix' can be passed too. Cross compiled libraries get
> installed into the prefix, and host-compiled tools like moc and qmake get
> installed to the hostprefix. In my patch, I install the toolchain file to
>
> $$hostprefix/cmake/Qt5Toolchain.cmake
Is hostprefix somewhere in lib/ ?
Alex
More information about the cmake-developers
mailing list