project file for 64 and 32 bit under linux
hi everyone,
i have two separate libraries for 32 bit and 64 bit. now i want to check in the project file, if the system is a 32 oder 64 bit system in order to use the correct library.
i am using ubuntu 10.04, Qt version 4.6.2 and i have the following part in my .pro file:
if(getconf LONG_BIT == 64) { #64 bit libs
INCLUDEPATH += x_i
LIBS += -L../x
}
else { #32 bit libs
INCLUDEPATH += y_i
LIBS += -L../y
}
"getconf LONG_BIT == 64" does not seem to work, is there a better way to solve this or is there something wrong with this line?
Re: project file for 64 and 32 bit under linux
I am not 100% sure, but I guess you have to wrap your getconf command inside the system function. Something like
Code:
if( system(getconf LONG_BIT) == 64) {
Re: project file for 64 and 32 bit under linux
... or you can use the mkspecs
Code:
linux-g++-32
{}
linux-g++-64
{}
Re: project file for 64 and 32 bit under linux
Quote:
Originally Posted by
Lykurg
I am not 100% sure, but I guess you have to wrap your getconf command inside the system function. Something like
Code:
if( system(getconf LONG_BIT) == 64) {
that did not work, about the mkspecs: i can not compile any files, i have to include either the 64 bit or the 32 bit libraries. or what did you mean with the mkspecs?
Re: project file for 64 and 32 bit under linux
Ok, I read the docs for you:
Code:
BITSIZE = $$system(getconf LONG_BIT)
if (contains(BITSIZE, 64)) {
message($$BITSIZE)
}
if (contains(BITSIZE, 32)) {
message($$BITSIZE)
}
linux-g++ {
message(On Linux)
}
macx-g++ {
message(On Mac)
}
for
Quote:
qmake -spec macx-g++ test.pro
it outputs
Quote:
Project MESSAGE: 64
Project MESSAGE: On Mac