Correct way to use custom library in Qt?

I have a special library to be included in Qt. It is currently enabled by adding the following .pro files.

INCLUDEPATH += ... DEPENDPATH += ... LIB += ... 

Since the library is used in most of my projects. I am wondering if there is a way to make my own library integrated with QtSDK? Perhaps it can be included in the syntax, for example, built-in components

 QT += my_custom_library 

and thatโ€™s it (the header file includes the path, the lib file include, etc.).

Is integration possible?

+3
source share
1 answer

You probably want to create the mkspec file, which is then used with the CONFIG option. So create a file in $ QT_HOME / mkspec / features / mycoollib.prf that contains your instructions. There should be many examples in this directory. The file name declares its use, so the mycoollib.prf file will be used as:

 CONFIG += mycoollib 
+4
source

Source: https://habr.com/ru/post/1368858/


All Articles