Qt5 detekcja w projekcie czy moduł jest wkompilowany

0

Czy na poziomie projektu (plik ".pro" używany przez qmake mozna zrobić detekcje czy dany modul jest wkompilowany w QT

Chciałbym warunkowo kompilować w zależności od tego co jest w systemie
Aktualnie chodzi mi o moduł "x11extras"
Chciałbym aby w momecie gdy jest "x11extras" to dodaje do projektu dwa pliki

contains(QT, x11extras): {
  message("Adding x11extras for XOrg platform.")
..
  HEADERS +=  \
           qx11info_x11_c.h.

  SOURCES +=  \
           qx11info_x11_c.cpp.

}

Jaka wartość ma zmienna QT , jest pusta i dodajemy moduły które chcemy aby byly w projekcie ?

1

chodzi ci o
qtHaveModule(MODUŁ)
?
przykłąd powinien być w webchannel.pro

2

Zabierasz się do tego od złej strony.
To ty masz zmodyfikować wartość QT w zależności od konfiguracji

Spróbuj pokombinować z tym:
Creating Project Files | qmake Manual

General Configuration

The CONFIG variable specifies the options and features that the project should be configured with.

The project can be built in release mode or debug mode, or both. If debug and release are both specified, the last one takes effect. If you specify the debug_and_release option to build both the debug and release versions of a project, the Makefile that qmake generates includes a rule that builds both versions. This can be invoked in the following way:

make all

Adding the build_all option to the CONFIG variable makes this rule the default when building the project.

Note: Each of the options specified in the CONFIG variable can also be used as a scope condition. You can test for the presence of certain configuration options by using the built-in CONFIG() function. For example, the following lines show the function as the condition in a scope to test whether only the opengl option is in use:

CONFIG(opengl) { message(Building with OpenGL support.) } else { message(OpenGL support is not available.) }

This enables different configurations to be defined for release and debug builds. For more information, see Using Scopes.

The following options define the type of project to be built.

Note: Some of these options only take effect when used on the relevant platform.

Option Description
qt The project is a Qt application and should link against the Qt library. You can use the QT variable to control any additional Qt modules that are required by your application. This value is added by default, but you can remove it to use qmake for a non-Qt project.
x11 The project is an X11 application or library. This value is not needed if the target uses Qt.

The application and library project templates provide you with more specialized configuration options to fine tune the build process. The options are explained in detail in Building Common Project Types.

For example, if your application uses the Qt library and you want to build it in debug mode, your project file will contain the following line:

CONFIG += qt debug

Note: You must use "+=", not "=", or qmake will not be able to use Qt's configuration to determine the settings needed for your project.

0

Byłem na tej stronie gdzie opisana jest funkcja qtHaveModule ale przeoczyłem !
Tak szukałem qtHaveModule , dziekuję!

Grzebie przy poprawieniu Qt5 dla lazarus-a
https://svn.freepascal.org/svn/lazarus/trunk/lcl/interfaces/qt5/cbindings/Qt5Pas.pro
Walczę z podniesieniem starego programu napisego w Lazarus, tylko że nowe Linux-y czasmi nie maja X11 a zamiast jest Wayland i trochę się rozrzedza.

1 użytkowników online, w tym zalogowanych: 0, gości: 1