Commit Graph

106 Commits

Author SHA1 Message Date
Cristian Adam
4f26d802ca CMakePM: Remove support for extra generators
They are marked as obsolete in CMake 3.27 and will be removed in a
future version of CMake.

Fixes: QTCREATORBUG-29603
Change-Id: I6e5d36441d05b87ee4467d13781f53d4269636ad
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-09-14 10:30:06 +00:00
hjk
4e0c4b0f23 CMake: Rename cmakekitinformation.{h,cpp} to cmakekitaspect.{h,cpp}
Follow up after renaming the contained classes.

Change-Id: I9393c367abdd4eac487e17676c98a357ff33c98c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-08-22 05:56:39 +00:00
hjk
aa25fdcc69 QtSupport: Rename qtkitinformation.{h,cpp} -> qtkitaspect.{h,cpp}
Change-Id: I12229e5e98b468101d32edd35be74bbda0921d89
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-08-15 08:59:52 +00:00
hjk
017d7c0e47 ProjectExplorer: Rename kitinformation.{h,cpp} to kitaspects.{h,cpp}
Change-Id: I069bddeb457366210d339edcbb8ffb359a40fab8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-08-15 07:31:03 +00:00
Cristian Adam
e33b8137df CMakePM: Handle qml debugging for CMake presets
Fixes: QTCREATORBUG-29311
Change-Id: I437d008a3625156e6a42f2ecaee71744bd9098f6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-07-06 14:08:14 +00:00
Cristian Adam
fe8c276d11 CMakePM: Auto detect generator when not specified in presets
Qt Creator would do a compiler probe for CMake presets when the compiler
was not set.

But the same needs to be done when the generator is not set. Otherwise
Qt Creator would set a different generator by default. On Windows is
"Ninja".

This is different from what CMake does from command line.

Task-number: QTCREATORBUG-28693
Change-Id: I96e917b11561a042f9476bad302f3f153e37bafd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-07-05 14:02:48 +00:00
hjk
adcf52e0c4 Fix some more *::count() deprecation warnings
Change-Id: Ib7d1552a6f7b167e15beb7ca1ef26c7d57e090e9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-07 07:29:34 +00:00
Eike Ziller
55dadd4f95 Merge remote-tracking branch 'origin/10.0' into 11.0
Change-Id: I27e2c1c764f955d14bfece6cd580b4c2d2988396
2023-05-25 08:29:27 +02:00
Cristian Adam
0d3d4892c6 CMakePM: Fix Qt detection for Presets with toolchain file
When CMAKE_TOOLCHAIN_FILE and CMAKE_PREFIX_PATH were both set, the later
was ignored.

This resulted in Kits being created without Qt and without Qml
Debugging.

Task-number: QTCREATORBUG-28982
Change-Id: Ib45b4ac8335391f85a0b9c321196597d1c0a7a3f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-24 13:59:14 +00:00
Cristian Adam
9ff0cf7306 CMakePM: Add action to reload CMake Presets
The CMake presets will be reloaded. The preset kits will get the CMake
configuration cleared (no more CMakeCache.txt)

All the kits will be removed from the project, so that the Kit
configuration wizard will be displayed at the end.

If a normal Qt Kit was configured, the user will get the chance to
import the existing configuration (the initial configuration will be
lost though).

Change-Id: Ieda83098d7716913d7870b67ab522705da4ed93b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-05-15 15:13:23 +00:00
Cristian Adam
8854f53a42 CMakePM: Fix duplicated CMake presets kits
QTC_KIT_DEFAULT_CONFIG_HASH was introduced in order to match the
previous CMake presets kits.

This would hash the Qt and the C/C++ compiler paths.

Unfortunately on Linux CMake would pick "cc" and "c++" by default,
whilst Qt Creator uses "gcc" and "g++". The compilers would match from
the Qt Creator point of view, but the hash values would be different.

On mac there is a similar issue with compiler launchers.

This patchset fixes this by removing the hash and fixes also the issue
of allowing broken CMake presets kits (without any compilers), which
were the reason for introducing the hash key in the first place.

Fixes: QTCREATORBUG-29075
Change-Id: Id8dc081febba7bc7023c98055afc6ebfcdc55542
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-05-04 15:19:44 +00:00
Jarek Kobus
a0f6e8dc04 Utils: Rename qtcprocess.{cpp,h} -> process.{cpp,h}
Follows QtcProcess -> Process rename.

Change-Id: I97235a9a40cb7fd52944515b7ab878d96528f919
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 05:52:26 +00:00
Jarek Kobus
470c95c94b Utils: Rename QtcProcess -> Process
Task-number: QTCREATORBUG-29102
Change-Id: Ibc264f9db6a32206e4097766ee3f7d0b35225a5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-04 05:52:16 +00:00
Cristian Adam
3dd4b98c0c CMakePM: Better Qt import detection
Qt6_DIR and Qt5_DIR CMake variables are additionally checked for
existence.

Qt6_ROOT and Qt5_ROOT are taken into consideration for both environment
and CMake variables.

CMAKE_PREFIX_PATH is also returned from the qmake probe. This fixes the
case when qt.toolchain.cmake is used exclusively.

Task-number: QTCREATORBUG-29075
Change-Id: I6e0c3adf7f5d9860a1cb776371e66dea1dfc26cc
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-03 11:38:07 +00:00
Cristian Adam
e2f83c74f4 Revert "CMakePM: Fix compile for gcc 7"
This reverts commit ca04d9afcd.

GCC 9 or later is the minimum required version nowadays, so this piece
of code can be more readable.

Change-Id: I939ee6cd62572d23d5b1de8d113472136752a590
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-02 15:25:22 +00:00
Cristian Adam
45faec05e5 CMakePM: expand macros for all configure cacheVariables
Fixes: QTCREATORBUG-28982
Change-Id: Iabbf39b815ed7477a9d272a320308f320a31adbc
Reviewed-by: hjk <hjk@qt.io>
2023-04-17 15:03:53 +00:00
Cristian Adam
40a22963be CMakePM: Fix presets with macros in CMAKE_BUILD_TYPE
Fixes: QTCREATORBUG-28893
Change-Id: Ifc4927a31c6a30c3c8ab083d8724207202c75aa1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-03-15 09:15:16 +00:00
Cristian Adam
05d9742a96 CMakePM: Expand CMake preset macros also for environment vars
This fixes the case when a CMake variable (CMAKE_PREFIX_PATH) would
reference an environment variable (qt_path) that would contain a CMake
preset macro (${sourceDir}/../qt_install).

Fixes: QTCREATORBUG-28606
Change-Id: Ib6239b13782b2ea854969547af46c3fe82a061f4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-03-11 08:56:06 +00:00
Orgad Shaneh
a5e98b1fa0 CMake: Avoid redundant copy
Amends commit e8802d92e3.

Reported by Coverity.

Change-Id: Ibc0b1cdf1918d5bfed5104f14098096d158526e2
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-02-21 10:48:58 +00:00
Cristian Adam
e8802d92e3 CMakePM: Add support for "external" arch and toolset
Fixes: QTCREATORBUG-28693
Change-Id: Id36f334c27f26a1f2ce65351de77e18d93b1a064
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-02-15 11:32:38 +00:00
Eike Ziller
d278135497 Merge remote-tracking branch 'origin/9.0' into 10.0
Change-Id: I8d73198561f6ff7877d580681ca2a0018b7dc3b1
2023-02-06 10:14:18 +01:00
Cristian Adam
51cbfd77db CMakePM: Improve CMake presets kit config hashing
Amends a3153c535d

QT_QMAKE_EXECUTABLE was not taken into consideration and this would
result in not matching kits.

Also Visual Studio generator will not have a CMAKE_C|XX_COMPILER values
in the cache.

On Windows there could be paths with "C:" vs "c:" and the hashes again
wouldn't match.

Change-Id: I5da5fafbd29f3d1fd8c9615c41b7659e63c30ff1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-02-02 15:56:46 +00:00
Eike Ziller
0dfa542bee Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/plugins/cppeditor/cppcodestylesettingspage.h

Change-Id: I1aa4e2f9efc6d9cf9f284aef1abf148be9b93a60
2023-01-10 15:44:55 +01:00
hjk
66c08a824d Utils: Rename most FilePath::{from,to}Variant uses to {from,to}Settings
Specifies the main purpose more clearly. The remaining ones a "true"
(internal) variants in models and as action data.

Change-Id: I8dd3c846e419f29d88283c2f48268ef6685b19fe
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-10 09:00:30 +00:00
Cristian Adam
a3153c535d CMakePM: Add default kit configuration hashing
This adds a QTC_KIT_DEFAULT_CONFIG_HASH variable containing the hash of
all the default Qt Creator CMake kit variables:
  * CMAKE_C_COMPILER
  * CMAKE_CXX_COMPILER
  * QT_QMAKE_EXECUTABLE
  * CMAKE_PREFIX_PATH

This way when a CMake preset changes any of these CMake variables a new
Kit will be created. Otherwise a previous kit containing different
values will be used.

Fixes: QTCREATORBUG-28609
Change-Id: I77b67e9c8fa15dc3ff2f22c5b63d4ca1c7670fdc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-06 18:01:32 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Eike Ziller
3f4c3a3db4 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/texteditor/texteditor.cpp

Change-Id: I9c8f1331be3f5442f1fd28aeb0a9bc07128629d1
2022-12-20 11:05:01 +01:00
Cristian Adam
70b3388684 CMakePM: Allow relative compiler paths for presets
You can have a preset with the PATH environment variable modified and
with CMAKE_C|XX_COMPILER CMake variables only as "gcc.exe" and "g++.exe"

Qt Creator now will search in PATH after the compiler file names and
work as expected.

Fixes: QTCREATORBUG-28602
Change-Id: I8520f6fcf5e542600fab08228d04d3709d3a8e8f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-19 11:52:37 +00:00
Jarek Kobus
d0e24654f6 CMakeProjectManager: Pass context object to lambda connections
Remove some unneeded lambda () brackets.
Remove some unneeded lambda return type specifiers.

Change-Id: I9695367d66a151f2611554b9fe5897c1bac7ef5c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-08 15:28:50 +00:00
Cristian Adam
83e77d71a8 CMakePM: Expand cache variables for the preset probe
This way the CMAKE_PREFIX_PATH set to $env{HOME}/Qt (Linux) or
$env{SystemDrive}/Qt (Windows) would work as expected.

Change-Id: I03a9102d6d1da2a8740cab738577c47c44166c6c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-25 20:56:06 +00:00
Cristian Adam
ec4d96a14b CMakePM: Accept broken kits for CMakePresets
For CMakePresets if a preset is broken we should not create a preset kit
for every build type.

Instead reuse the broken kit created by the first build type.

Task-number: QTCREATORBUG-28295
Change-Id: I038fbb23817834f59ac73ccd2f9953f1a412b656
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-25 20:55:08 +00:00
Cristian Adam
7dfc7c627b CMakePM: Allow presets without generator specified
This allows presets that do not have a generator specified to proper
work.

On Windows CMake will detect "Visual Studio" as generator. This change
sets the generator and the architecture values accordingly.

Change-Id: I943e082430445c4b16cf9eaf4ae5ae2500b2bd2b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-25 20:54:59 +00:00
Cristian Adam
1c51dc1adf CMakePM: Do not use systemEnvironment() for CMakePresets
This doesn't mean that CMakePresets will work with a remote project, but
at least it avoids Environment::systemEnvironment() usage.

Change-Id: I17081c747d32e50224ac74507d3aa336ff5c8948
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-10-19 10:08:06 +00:00
Cristian Adam
c1667f9bea CMakePM: Allow default build configurations for presets
Restrict the build types only if CMAKE_BUILD_TYPE or
CMAKE_CONFIGURATION_TYPES cache variables are set.

Change-Id: Ib88dcd5d4a0fca86f86e95815edff1116f896324
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-11 11:21:46 +00:00
Cristian Adam
f84bdee045 CMakePM: Allow presets without buildDirectory
CMakePresets v3 relax the requirement of having the buildDirectory
specified.

This way Qt Creator should use its own mechanism of specifying the build
directory.

Change-Id: I6ba69e6a03cdc058e7b8fa540a6fc564356aba63
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-11 11:21:41 +00:00
Cristian Adam
05acf3e6f4 CMakePM: Do not display duplicated build paths for presets
If we configure a project with presets, build all the configurations,
then delete the CMakeLists.txt.user file to re-configure the presets, we
shouldn't get two entries in the initial configuration dialog.

Change-Id: I9bb234aa54fcce193dbd07dd3aa77e91f639b179
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-10 14:48:28 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Cristian Adam
ee4c998ff3 CMakePM: Add supprot for CMakePresets version 3
This includes Condition and toolchainFile

https://cmake.org/cmake/help/v3.21/manual/cmake-presets.7.html

Task-number: QTCREATORBUG-24555
Change-Id: I1026390af67b2be1aa0c3b02b654fc19442d3c89
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-30 08:34:07 +00:00
Cristian Adam
45a275e054 CMakePM: Use architecture and toolset for project import
This fixes issues with Visual C++ generator, which needs the right
parameters to pinpoint the right compilers.

Also use CMAKE_TOOLCHAIN_FILE for qmake detection.

Change-Id: I6edc84c7ed1a892fbc5545ff61dc06ac20720f0a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-30 08:34:00 +00:00
hjk
ab4c9b9679 CMake: Move to Tr::tr
Change-Id: I169da93b5184351cb915d4c198fd33318fcfe06f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-30 06:56:21 +00:00
hjk
21c5d3499b CMakeProjectManager: Compile fix
Amends bcadea228.

Change-Id: I4f85780ffa6c7c79c70c096b457065f95e96355f
Reviewed-by: hjk <hjk@qt.io>
2022-09-26 16:15:11 +00:00
hjk
985c8b1a43 ProjectManager: Return FilePaths from ProjectImporter::importCandidates
Proliferates FilePath use a bit further. Actual changes to the
individual importers are left for further patches.

Change-Id: Ie7c6b2e3f4ac7d0eca6d2f56d30fb23354bb404b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-09-26 16:02:55 +00:00
hjk
bcadea2285 CMake: FilePath-ify CMakeProjectImporter
Change-Id: Ifffd3328afae60a4015d88e36b3e60b4ee492c3b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-09-26 15:16:36 +00:00
Cristian Adam
5a156395c4 CMakePM: configure presets review fixes
Amends 2ab1e76ca9

Change-Id: Id10f0d4da6a60223d68af3cea6c5263f7c8c62f2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-09-26 12:04:37 +00:00
Cristian Adam
2ab1e76ca9 CMakePM: Add support for configure CMake presets
This patchset will add support for version 1 of the CMakePresets
feature that has been implemented in CMake 3.19

https://cmake.org/cmake/help/v3.19/manual/cmake-presets.7.html

The tests/manual/cmakepresets contains a manual test example for this
feature.

Task-number: QTCREATORBUG-24555
Change-Id: I93aba1ab4f090613d0b21d970b5b651d12c922af
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-14 11:50:49 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Alessandro Portale
afe0b5a42d Utils: Use FilePaths alias instead of QList<FilePath>
Change-Id: I2eb0956377e46a34e73208b301eb662704a25e8b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-21 16:05:38 +00:00
Cristian Adam
8d99df9a7c CMakePM: remove unused headers, enforce sorting of headers
Used clangd hints.

Change-Id: Iade4de67c1d2e5fdd1a880c5603b31203170ebbe
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-11 08:43:09 +00:00
Cristian Adam
5edbf915a4 CMakePM: Fix registering CMake as version 0.0.0
When importing a CMake build, the CMake version that's used in the build
could be registered as "CMake 0.0.0". This is obviously wrong.

Fixes: QTCREATORBUG-26999
Change-Id: I1401106806c4356516e8235a3767d9615e4d428d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-29 12:41:34 +00:00
Eike Ziller
a760d5ad81 CMake: Make QML debugging state reflect build system state
After parsing the CMake response, we make the configuration variables
table reflect the actual configuration in the build directory. It is one
of our "promises" that we do not break an existing build configuration,
to avoid unexpected rebuilds.

This was not quite true for the "QML debugging and profiling" setting.
When that setting and the actual build directory disagreed, the user
would get a dialog asking for running CMake with additional parameters,
and when running CMake via the button in projects mode or the menu, it
would just change these configuration parameters, potentially leading to
an unexpected complete rebuild of the application.

So, after parsing check if the actual CMake configuration matches our
QML debugging setting, and if not, change the setting to "Leave at
Default", to ensure that we don't mess with the build.

Fix the "Run CMake" button state (in the "Current Configuration") when
changing the QML debugging option, which should become bold, if the
CMake parameters change.

Amends 2577ce8ba1 and fixes the drawback
mentioned there, i.e. setting the build directory of a "Debug" build
configuration to an existing build directory with QML debugging
disabled, will now simply set the QML debugging option to "Leave at
Default" instead of forcing it to "Enabled".

Change-Id: Ie6d4875d59319687d94e44e459ca76038e5813c0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-06-13 10:03:38 +00:00