[CMake] CMake, QT5 and cross compilation

Hauke Krüger krueger at ind.rwth-aachen.de
Thu Dec 17 12:03:06 EST 2015


Hi everybody,

I have a project which builds to realize a Qt5 application. I use the
latest CMAKE Qt5 mechanisms such as AUTOMOC etc with good success.

The project builds on Raspberry Pi if cmake is run on the Raspberry Pi
itself since all Qt tools are available and run also on the Raspberry Pi.

Lately, I wanted to compile this project in a cross compile approach.
For this purpose, I mount the Raspberry Pi file system to be part of the
directory tree on my host Linux PC.
Of course, I use find_package to locate the Qt5 package in the directory
branch related to the Raspberry Pi. The corresponding
moc, uic and rcc tools have been built for arm. Therefore, I can not
run the moc from the location as reported by find_package in the cross
build approach.

So, here is my question: How can I overwrite the moc-executable (and uic
etc) path to use another moc version than the one found by the
find_package mechanism? If I use the moc which is part of my Linux host
PC rather than the arm compiled moc in the Raspberry file system, the
code generation should be fine, and afterwards, I will link against the
Raspberry Pi Qt5 libraries.

Thank you for any help and best regards

Hauke



More information about the CMake mailing list