Qt6 Build System: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
For a description of terms used here, please see the [[Qt Build System Glossary]].  
For a description of terms used here, please see the [[Qt Build System Glossary]].  


When writing CMake code, beware of the [[CMake Language Pitfalls]].  
When writing CMake code, beware of the [[CMake Language Pitfalls]].
 
There is some historical information at [[CMake Port]].


At the moment, there's not much here. We plan to extend this in the future.
At the moment, there's not much here. We plan to extend this in the future.

Revision as of 14:06, 20 March 2024


This is a description of the Qt6 CMake-based build system.

For Qt5, see Qt5 Build System.

For a description of terms used here, please see the Qt Build System Glossary.

When writing CMake code, beware of the CMake Language Pitfalls.

There is some historical information at CMake Port.

At the moment, there's not much here. We plan to extend this in the future. There's some information from the times of the initial CMake port. See below.

The configuration system

This is supposed to be a reference of Qt-specific CMake functions one can use in configure.cmake files. Since the port currently is still evolving quite rapidly, things may change. The ultimate reference is the code in qtbase/cmake/.

Commands in configure.cmake

qt_feature("<feature>" ...)

Defines a feature called <feature>. Whether a feature is enabled can be then elsewhere be checked by QT_FEATURE_<name>.

qt_feature("<feature>" [PUBLIC] [PRIVATE]  
                [LABEL "<label>"] 
                [PURPOSE "<purpose>"] 
                [SECTION "<selection>"] 
                [AUTODETECT <condition>] 
                [CONDITION <condition>]
                [ENABLE <condition>]
                [DISABLE <condition>]
                [EMIT_IF <condition>])

PUBLIC or PRIVATE defines whether the feature is available within the Qt module, or also in other Qt modules.

qt_feature_definition("<feature>" "<name>" ...)

Makes a C++ define <name> available.

qt_feature_definition("<feature>" "<name>" [NEGATE] [VALUE "<value>"])

If <value> is set, the define will have this as value.

If NEGATE is given, the define is set only if the feature is disabled. Otherwise it is set only if it is enabled.