Difference between revisions of "CMake Port/Configure System"

From Qt Wiki
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
This is supposed to be a reference of Qt-specific CMake functions one can use in <tt>configure.cmake</tt> files. Since the port currently is still evolving quite rapidly, things may change. The ultimate reference is the code in [http://code.qt.io/cgit/qt/qtbase.git/tree/cmake?h=wip/cmake qtbase/cmake/].
 +
 
== CMake Functions ==
 
== CMake Functions ==
  
=== qt_feature ===
+
=== qt_feature("<feature>" ...) ===
  
Declares a Qt feature.  
+
Defines a feature called <feature>.  Whether a feature is enabled can be then elsewhere be checked by <tt>QT_FEATURE_<name></tt>.
  
<pre>qt_feature(<name> [PRIVATE] [PUBLIC]  
+
<code>qt_feature("<feature>" [PUBLIC] [PRIVATE]
                 [LABEL <label>]  
+
                 [LABEL "<label>"]  
                 [PURPOSE <purpose>]  
+
                 [PURPOSE "<purpose>"]  
                 [SECTION <selection>]  
+
                 [SECTION "<selection>"]  
 
                 [AUTODETECT <condition>]  
 
                 [AUTODETECT <condition>]  
 
                 [CONDITION <condition>]
 
                 [CONDITION <condition>]
 
                 [ENABLE <condition>]
 
                 [ENABLE <condition>]
 
                 [DISABLE <condition>]
 
                 [DISABLE <condition>]
                 [EMIT_IF <condition>])</pre>
+
                 [EMIT_IF <condition>])</code>
  
 +
<tt>PUBLIC</tt> or <tt>PRIVATE</tt> defines whether the feature is available within the Qt module, or also in other Qt modules.
  
== CMake Macros ==
+
=== qt_feature_definition("<feature>" "<name>" ...) ===
  
=== qt_parse_all_arguments ===
+
Makes a C++ define <tt><name></tt> available.
  
A version of cmake_parse_arguments that makes sure all arguments are processed and errors out with a message about ${type} having received unknown arguments.
+
<code>
 +
qt_feature_definition("<feature>" "<name>" [NEGATE] [VALUE "<value>"])
 +
</code>
  
''Internal API.''
+
If <tt>&lt;value&gt;</tt> is set, the define will have this as value.  
  
<pre>qt_parse_all_arguments(<result> <type> <flags> <options> <multiopts>)</pre>
+
If <tt>NEGATE</tt> is given, the define is set only if the feature is disabled. Otherwise it is set only if it is enabled.

Latest revision as of 13:44, 11 February 2019

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/.

CMake Functions

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.