For a simple on/off switch you can just use qmake and a scope:
has_foo {
message("Has foo")
DEFINES += ENABLE_FOO
INCLUDEPATH += ...
LIBS += ...
}
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += main.cpp
has_foo {
message("Has foo")
DEFINES += ENABLE_FOO
INCLUDEPATH += ...
LIBS += ...
}
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
and then either
$ qmake CONFIG+=has_foo
OR
$ qmake
$ qmake CONFIG+=has_foo
OR
$ qmake
To copy to clipboard, switch view to plain text mode
On Linux platform you can often use pkg-config to test the availability of a given library and obtain the correct include and/or lib paths.
$ pkg-config --exists QtGui && echo "QtGui exists"
QtGui exists
$ pkg-config --cflags QtGui
-DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore
$ pkg-config --libs QtGui
-L/usr/lib/qt4 -lQtGui -lQtCore
$ pkg-config --exists QtGui && echo "QtGui exists"
QtGui exists
$ pkg-config --cflags QtGui
-DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore
$ pkg-config --libs QtGui
-L/usr/lib/qt4 -lQtGui -lQtCore
To copy to clipboard, switch view to plain text mode
You can combine that into the qmake pro file:
system(pkg-config --exists foo) {
message("Has foo")
...
}
system(pkg-config --exists foo) {
message("Has foo")
...
}
To copy to clipboard, switch view to plain text mode
Bookmarks