1
# shamelessly copied over from oxide’s build system
2
# to enable ARM cross compilation
4
if(CMAKE_CROSSCOMPILING)
5
# QT_MOC_EXECUTABLE is set by Qt5CoreConfigExtras, but it sets it to
6
# the target executable rather than the host executable, which is no
7
# use for cross-compiling. For cross-compiling, we have a guess and
8
# override it ourselves
9
if(NOT TARGET Qt5::moc)
12
PATHS /usr/lib/qt5/bin /usr/lib/${HOST_ARCHITECTURE}/qt5/bin
14
if(QT_MOC_EXECUTABLE STREQUAL "QT_MOC_EXECUTABLE-NOTFOUND")
15
message(FATAL_ERROR "Can't find a moc executable for the host arch")
17
add_executable(Qt5::moc IMPORTED)
18
set_target_properties(Qt5::moc PROPERTIES
19
IMPORTED_LOCATION "${QT_MOC_EXECUTABLE}")
22
# Dummy targets - not used anywhere, but this stops Qt5CoreConfigExtras.cmake
23
# from creating them and checking if the binary exists, which is broken when
24
# cross-building because it checks for the target system binary. We need the
25
# host system binaries installed, because they are in the same package as the
26
# moc in Ubuntu (qtbase5-dev-tools), which is not currently multi-arch
27
if(NOT TARGET Qt5::qmake)
28
add_executable(Qt5::qmake IMPORTED)
30
if(NOT TARGET Qt5::rcc)
31
add_executable(Qt5::rcc IMPORTED)
33
if(NOT TARGET Qt5::uic)
34
add_executable(Qt5::uic IMPORTED)
36
if(NOT TARGET Qt5::DBus)
37
add_executable(Qt5::DBus IMPORTED)
40
# This should be enough to initialize QT_MOC_EXECUTABLE