qt qmake conditional libs based on platform
-
Hi
in .pro file I havewin32
{
LIBS += -lole32
}and in linux it still wants to add that lib?
So syntax is incorrect or wont work for LIBS ? -
so this syntax
win32
{}
only works for includes / files?
win32 {
SOURCES += paintwidget_win.cpp
} -
Hi,
it's because of the line return. It should be
win32 { #<< start of scope LIBS += -lole32 }
The scope of win32 starts on the line you write it. So if you add a line return, the content of your brackets fall in the global scope.
-
Hi,
it's because of the line return. It should be
win32 { #<< start of scope LIBS += -lole32 }
The scope of win32 starts on the line you write it. So if you add a line return, the content of your brackets fall in the global scope.
-
@SGaist ,
I know that we can write : LIBS += -lole32
But if we specify that win32: LIBS += -lole32
don't we need to specify it to linux ? thank's in advance,
-
well actually I ended up with
win32: LIBS += -lole32
else:unix: LIBS += -luuidbut it was just me not understanding the real syntax with
win32 {
}
as I did
win32
{
}
which is not the same. :) -
Target and arch selector in qmake (I have used this in my project):
win32:{ contains(QMAKE_TARGET.arch, x86_64):{ PLATFORM = "win-64" }else{ PLATFORM = "win-32" } }else{ BITSIZE = $$system(getconf LONG_BIT) if (contains(BITSIZE, 64)) { linux*: PLATFORM = "linux-64" macx*: PLATFORM = "mac-64" } if (contains(BITSIZE, 32)) { linux*: PLATFORM = "linux-32" macx*: PLATFORM = "mac-32" } android: PLATFORM = "android" ios: PLATFORM = "ios" } #include pri file based on platform include(myproj-$${PLATFORM}.pri)