QMake - Architecture specific conditional compilation
-
Hi, I'm wondering how I would conditionally include files in a project file, based on the architecture i'm building for. What I'd like to do is something like the following:
@unix {
SOURCES += a.cpp
SOURCES += b.cppLIBS += -lfoo
x86 {
SOURCES += c_x86.cpp
LIBS += -lbar
}
arm {
SOURCES += c_arm.cpp
}
}
@ -
I'd try a scope with something like
@
contains(QMAKE_TARGET.arch, x86)
@ -
Unfortunately, that does not seem to work.
-
@CONFIG+= arm11
arm11 {@PS What means arm? arm7, arm9, arm11?
-
Wait a minute, are we talking about the architecture you're (cross) compiling for or the host architecture?
[quote author="Alexandr Ekimov" date="1313508331"]@CONFIG+= arm11
arm11 {@PS What means arm? arm7, arm9, arm11?[/quote]
The name of the specific ARM architecture.
-
My compilation host will likely always be x86 or x86_64, but I'm working on code that needs to be compiled for both x86 and ARM
-
Ok. What do QMAKE_HOST.arch and QMAKE_TARGET.arch contain for your setup?