Doc: Update info on CMake presets

- Described overriding CMake project settings in CMake presets
  or a CMakeLists.txt.shared file
- Added an example of setting debuggers
- Added an example of cross-compiling and running on the wine emulator

Task-number: QTCREATORBUG-30604
Change-Id: I04f26d98e21b1a1a214de5ab4451ac1e758e489e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Leena Miettinen
2024-06-20 16:34:44 +02:00
parent 1ab00ae5ec
commit 2f2ed24092
5 changed files with 123 additions and 7 deletions

View File

@@ -163,7 +163,11 @@ Projects
[QTCREATORBUG-29559](https://bugreports.qt.io/browse/QTCREATORBUG-29559), [QTCREATORBUG-29559](https://bugreports.qt.io/browse/QTCREATORBUG-29559),
[QTCREATORBUG-30385](https://bugreports.qt.io/browse/QTCREATORBUG-30385)) [QTCREATORBUG-30385](https://bugreports.qt.io/browse/QTCREATORBUG-30385))
* Made it possible to register debuggers * Made it possible to register debuggers
([QTCREATORBUG-30836](https://bugreports.qt.io/browse/QTCREATORBUG-30836))
* Added support for custom build types * Added support for custom build types
([QTCREATORBUG-30014](https://bugreports.qt.io/browse/QTCREATORBUG-30014))
([Documentation](https://doc-snapshots.qt.io/qtcreator-14.0/creator-build-settings-cmake-presets.html))
### Workspace ### Workspace

View File

@@ -58,11 +58,25 @@
"environment": { "environment": {
"AN_ENVIRONMENT_FLAG": "1" "AN_ENVIRONMENT_FLAG": "1"
} }
},
"vendor": {
"qt.io/QtCreator/1.0": {
"AskBeforePresetsReload": false,
"AskReConfigureInitialParams": false,
"AutorunCMake": false,
"PackageManagerAutoSetup": false,
"ShowAdvancedOptionsByDefault": true,
"ShowSourceSubFolders": false,
"UseJunctionsForSourceAndBuildDirectories": true
}
} }
] ]
} }
\endcode \endcode
For more information about the CMake project settings in the \c vendor
section, see \l {Override CMake settings for a project}.
\section1 MinGW Example \section1 MinGW Example
The following example configures a Qt project with: The following example configures a Qt project with:
@@ -74,6 +88,7 @@
\li generator MinGW Makefiles \li generator MinGW Makefiles
\li path to a CMake executable \li path to a CMake executable
\li path to the Qt installation via \c CMAKE_PREFIX_PATH \li path to the Qt installation via \c CMAKE_PREFIX_PATH
\li GNU gdb 11.2.0 for MinGW 11.2.0 64-bit debugger
\endlist \endlist
\badcode \badcode
@@ -92,6 +107,15 @@
}, },
"environment": { "environment": {
"PATH": "C:/Qt/Tools/mingw1120_64/bin;$penv{PATH}" "PATH": "C:/Qt/Tools/mingw1120_64/bin;$penv{PATH}"
},
"vendor": {
"qt.io/QtCreator/1.0": {
"debugger": {
"DisplayName": "GNU gdb 11.2.0 for MinGW 11.2.0 64-bit",
"Abis": ["x86-windows-msys-pe-64bit"],
"Binary": "C:/Qt/Tools/mingw1120_64/bin/gdb.exe",
"EngineType": 1,
"Version": "11.2.0"
} }
} }
] ]
@@ -188,6 +212,50 @@
} }
\endcode \endcode
\section1 Cross-Compilation Example
The following example configures a Qt project for cross-compilation on \macos
for Windows and running with the \c wine emulator on \macos:
\list
\li generator Ninja
\li build directory \c <sourceDir>/build-release
\li LLVM/MinGW toolchain
\li configuration type \c CMAKE_BUILD_TYPE as \c Release
\li LLDB 18.1.6 debugger
\li \c wine emulator
\endlist
\badcode
{
"version": 4,
"configurePresets": [
{
"name": "llvm-mingw",
"displayName": "LLVM-MinGW 18.1.6",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-release",
"toolchainFile": "llvm-mingw.cmake",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CROSSCOMPILING_EMULATOR": "/opt/homebrew/bin/wine"
},
"vendor": {
"qt.io/QtCreator/1.0": {
"debugger": {
"DisplayName": "LLDB 18.1.6 (CMake Preset)",
"Abis": ["x86-darwin-generic-mach_o-64bit", "arm-darwin-generic-mach_o-64bit"],
"Binary": "/Users/jdoe/llvm-mingw/bin/lldb",
"EngineType": 256,
"Version": "18.1.6"
}
}
}
}
]
}
\endcode
\section1 Using Conditions \section1 Using Conditions
The following configure presets are used if they match \c condition. That is, The following configure presets are used if they match \c condition. That is,

View File

@@ -67,6 +67,9 @@
\li \l{Using Junction Points on Windows} \li \l{Using Junction Points on Windows}
\endtable \endtable
You can set these preferences as \l{Configure Presets}{CMake presets} or in
a \l{Share project settings}{CMakeLists.txt.shared} file.
\sa {Build with CMake}{How To: Build with CMake}, {CMake}, \sa {Build with CMake}{How To: Build with CMake}, {CMake},
{Configuring Projects} {Configuring Projects}
*/ */

View File

@@ -44,9 +44,16 @@
Then, you must edit the build settings of the project to specify the Then, you must edit the build settings of the project to specify the
location of the file and the contents of the Conan install command. location of the file and the contents of the Conan install command.
Alternatively, you can automatically set up the Conan package manager for \section1 Automatic Package Manager Setup
use with CMake.
To automatically set up the Conan package manager for use with CMake,
go to \uicontrol Projects > \uicontrol {Project Settings} > \uicontrol CMake,
and select \uicontrol {Package manager auto setup}.
To turn off the automatic package manager setup, set
\c PackageManagerAutoSetup to \c false in \l{Configure Presets}
{CMake presets} or a \l{Share project settings}{CMakeLists.txt.shared} file.
\sa {Conan Build Configuration}, {Enable and disable plugins}, \sa {Conan Build Configuration}, {Enable and disable plugins},
{Using CMake with Package Managers} {Override CMake settings for a project}, {Using CMake with Package Managers}
*/ */

View File

@@ -20,7 +20,8 @@
has the same XML structure as a \e {.user} file, but only has the has the same XML structure as a \e {.user} file, but only has the
settings to share. settings to share.
\note Use \l{CMake Presets} to share CMake project settings. To share CMake project settings, use \l{CMake Presets} or a
\c {CMakeLists.txt.shared} file.
\section1 Create a shared settings file \section1 Create a shared settings file
@@ -72,5 +73,38 @@
a permanent sticky setting that was created just because you wanted to try a permanent sticky setting that was created just because you wanted to try
something out. something out.
\section1 Share CMake project settings
The following is an example of a \c {CMakeLists.txt.shared} file:
\badcode
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<qtcreator>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="CMakeSpecificSettings">
<value type="bool" key="AskBeforePresetsReload">false</value>
<value type="bool" key="AskReConfigureInitialParams">false</value>
<value type="bool" key="AutorunCMake">false</value>
<value type="bool" key="PackageManagerAutoSetup">false</value>
<value type="bool" key="ShowAdvancedOptionsByDefault">true</value>
<value type="bool" key="ShowSourceSubFolders">false</value>
<value type="bool" key="UseGlobalSettings">false</value>
<value type="bool" key="UseJunctionsForSourceAndBuildDirectories">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>
\endcode
For more information about the settings, see
\l {Override CMake settings for a project}.
\sa {Configuring Projects}, {CMake Presets} \sa {Configuring Projects}, {CMake Presets}
*/ */