Commit Graph

242 Commits

Author SHA1 Message Date
Cristian Adam
bcc45d8bb9 CMakePM: Allow navigation to ${PROJECT_NAME}
Task-number: QTCREATORBUG-27211
Change-Id: I23e2c6f39ff3d4c89ef78a66c10e619e3df3245f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-31 15:52:41 +00:00
Christian Stenger
79becbaeac CMakePM: Protect against accidental nullptr access
Wizard summary page does not provide a list to put in failed
files, so ending up inside the build systems addFiles() may
pass in a nullptr. Guard against its access.

Change-Id: Ia858f8029b1b840cc341d87614576f2634b995dc
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-30 05:24:35 +00:00
Cristian Adam
55cccfa59e CMakePM: clang-tidy fix for 'no-automatic-move'
See https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-
tidy/checks/performance/no-automatic-move.html

Change-Id: If265c9b0e2aea49e5923f079cd621e10bb958286
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 13:57:34 +00:00
Cristian Adam
69815af272 CMakePM: clang-tidy fix for 'performance-implicit-conversion-in-loop'
Change-Id: I67e5adad19a3454986381c5548bbe96cf1cc1e6a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-20 13:57:28 +00:00
Eike Ziller
abeb2287ce Tr: Fix some quoting
Change-Id: I91c515822d48b4efb7c7869c5afe06b5375bf20e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-16 13:16:00 +00:00
Cristian Adam
cbeeec2dc6 CMakePM: Fix Coverity issue "Arguments in wrong order"
Coverity-Id: 1526499
Change-Id: I4b5d7c4d12eca39b9c4e60b45ea3e67bce069069
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-10-09 09:14:40 +00:00
Cristian Adam
1d2c942360 CMakePM: Only process cmake files for include and modules
... and not for every function. Just the CMake files.

Change-Id: I6e361f4913f8334942a3135adaa0480fdc0cee31
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-06 19:41:59 +00:00
Cristian Adam
16dfd2d374 CMakePM: Add "[cmake] " prefix to all output messages
With this one could easily filter the "[cmake] " messages from all the
messages in the "Generate Messages" pane.

Change-Id: I690650f0ccb0372c9361b95cfec41809737720d7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-05 15:15:32 +00:00
Cristian Adam
3705b4b609 CMakePM: Navigate to find_package CMake files
Fixes: QTCREATORBUG-25524
Change-Id: I6dc7dc1b2d0da06ceba0314438d3bd12467a3223
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-02 12:50:32 +00:00
Cristian Adam
762b0518a2 CMakePM: Handle include(CMakeFileWithoutSuffix) navigation
Check that the function operating upon is "include" and then match the
word under cursor with a file from the project.

Change-Id: Ia0131f08515c56582a1fb02a59d6b2e41ac04288
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-02 11:05:36 +00:00
Cristian Adam
776c8670d7 CMakePM: Handle project FindPackage package variables
For example find_package(ZLIB QUEIT) will result in the package
variables ZLIB_LIBRARY ZLIB_INCLUDE_DIR.

The variables are available for both code completion and navigation.

Change-Id: I4ea6090f44a980dc91632fcabbda16987b0f0285
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-28 10:49:56 +00:00
Cristian Adam
d08f1c6e94 CMakePM: Allow navigation to project targets
They were available via Ctrl-K and "cmo <target_name>". But they should
be working also in the text editor.

Change-Id: Iaad72b784485364776b67d6dfdef7ba73dd2df70
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-28 10:36:40 +00:00
Cristian Adam
d915e22adb CMakePM: Add imported targets to code completion / navigation
This allows e.g. Qt6::Core to be specified as argument for
target_link_libraries and navigation via F2.

Also fixes a bug introduced with
695952f84b which removed the project
specific features due to project being nullptr.

Change-Id: I5efa28c498d337e6bab564533a5445e6c364b26b
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-28 10:36:29 +00:00
Cristian Adam
05614ab740 CMakePM: Display help details for code completion
The first 1024 bytes from the CMake .rst files are displayed raw data.

A .rst to html or markdown would be needed for nicer user experience.

Change-Id: Ie6adbb404d844ae88b868b465d4125c2177e6cfe
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-25 13:41:34 +00:00
Cristian Adam
0632648be6 CMakePM: Remove the CMake introspection after CMake project load
Will be done in the CMake editor. No need to slow the project loading
when you don't do any editing of CMake files.

Initially I wanted to have it already loaded when code completion is
done, but doing once when a CMake editor is opened is better.

Change-Id: I1eda2a64e708bfa4fab5ab749059a08769800eba
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-22 10:33:36 +00:00
Cristian Adam
ed1568309b CMakePM: Add CMake Profiler action
Change-Id: I17f258834724c37f0933d18b6214851be1965913
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-21 18:39:53 +00:00
Cristian Adam
bc1c24eb84 CMakePM: Revamp the CMake code completion
By using KSyntaxHighlighting's metadata from the cmake.xml file.

With this information the code completion has localized arguments for
functions.

Added support for Generator Expressions $< and function ${ completions.

The project functions/macros and options are also taken into
consideration.

The file completion is using FilePaths and should work remotely.

Change-Id: I79d1360c1249c65c9db65349f326be5d41f0f734
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-18 15:22:39 +00:00
Cristian Adam
4d358ae337 CMakePM: Jump to function/macro/option definitions in CMake editor
Fixes: QTCREATORBUG-25523
Change-Id: If9ab6651a858e5fa08e8a1c321cb1f757831e14a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-14 18:10:22 +00:00
Tim Jenssen
1a3a8ecc96 Merge remote-tracking branch 'origin/qds/dev'
Change-Id: Id242ab4ca485527defdcc1555d204e12e50ddb7a
2023-09-14 17:37:24 +02:00
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
Cristian Adam
74640c6d5b CMakePM: Fix crash
Amends 6528bd3eed

Fixes: QTCREATORBUG-29587
Change-Id: I62e469a461dd730858e05d0309151dba4e9fe93c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-09-12 11:56:28 +00:00
Eike Ziller
2792166574 Merge remote-tracking branch 'origin/11.0'
Change-Id: Ifab8b72af33de4decf20d2a879bea4dfba1e9fbe
2023-09-07 11:15:32 +02:00
Cristian Adam
e892a6224f CMakePM: Save document before doing file operations on the CMake
Fixes: QTCREATORBUG-29550
Change-Id: I5ec360a48adce0d51a7fbe1704c7d4a9125bd913
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-09-05 08:41:43 +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
8346905a51 QtSupport: Remove unusual access pattern to plugin constants
Change-Id: Ifc21607cd9927e99b5c49f1631d8940725a058fd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-08-21 07:41:45 +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
Artem Sokolovskii
3ab2da691d DAP: Add check that cmake 3.27 or higher
If CMake version is lower then 3.27
- Shows the warning in general message
- Starts CMake without debugging
- Stops debugging correctly

Change-Id: Ibb13555c20ae2961c0a3c2ef6ec0fcc25930dddc
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-08-14 13:41:39 +00:00
hjk
0be0772fc9 Merge remote-tracking branch 'origin/11.0'
Change-Id: Ib67c8ecb1865ee31ca6485c9287039ba877c68cd
2023-08-10 10:03:04 +02:00
Cristian Adam
6528bd3eed CMakePM: Find the right AUTOUIC generated header
Amends c4e15769ec

When using ui files in static libraries AUTOUIC reports fake header file
names.

By using the target that includes the source ui file we can find the
correct header file name.

Change-Id: I1c8e0b81ad2c670be87c3620f98bd0f5cce40cd1
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-08-09 09:48:27 +00:00
David Schulz
0ece08c9dc Merge remote-tracking branch 'origin/11.0'
Change-Id: Iad820911996f8daff6ce63b4f0267bd15d35d176
2023-08-08 07:34:26 +02:00
Cristian Adam
c4e15769ec CMakePM: Fix AUTOUIC ui_header.h file code completion
The wrong header was reported to the extraCompiler when AUTOUIC was set.

Fixes: QTCREATORBUG-28787
Change-Id: I92d37e56ee5e45229545184e4f4911764834ed67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-08-04 15:29:25 +00:00
Artem Sokolovskii
cd6e990de8 DAP: Add CMake debug to the debug panel
This commit introduces the capability to initiate
CMake Debug sessions directly from the debug panel
in the QtCretor.

Change-Id: I00245e0e14aded378e881c4049cdc41dd1fbd00e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-07-14 08:47:01 +00:00
hjk
5f9408ee8d CMake: Move some functions from build system to build config
Less indirection.

Change-Id: I3a0a41c360b051cf0a3021d57d437fbde8f0736e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-07-10 11:50:42 +00:00
hjk
dbdd6a0701 CMake: Pass CMakeBuildConfig to the settings widget
... instead of the build system. Less indirections overall.

Change-Id: I59b2fd4508b24a72357426439cac7fbd563e05bf
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-07-10 11:50:10 +00:00
hjk
b9cf021b8e CMakeProjectManager: Use aspects more directly in build configuration
Change-Id: I35b9a31c158cac8eccb44ffb3f4e2d21d8183b8b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-07-10 11:48:30 +00:00
hjk
3e155919eb CMake: Use current pattern to access main settings page
Change-Id: I95c556bebe1d583879b6702f727d9a859b9a4bcb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-07 12:57:27 +00:00
Eike Ziller
dff9e1463b Reduce usage of app_version header
Most information is available via Q(Core|Gui)Application.
Add an AppInfo structure for the things that are not.

This avoids that the information ends up duplicated and
hardcoded in the plugins, which is not needed or desired.

Change-Id: I4d565e75c42a7b8facafa90c27096ea49359215d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-26 06:57:46 +00:00
Christian Kandeler
cf6bd7e012 Fix occurrences of the contains/insert anti-pattern
Introduce and make use of Utils::insert() for QSet with a return value
that indicates whether insertion actually happened.

Change-Id: I655e4bc3553b74fea5ae8956205e4d8070118d63
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-23 09:51:54 +00:00
hjk
904fa0aca3 CMake: Check for CMakeCache.txt also in remote builds
Change-Id: Ide179188a7fbd10b122a6bb34de08f943324133f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-06-12 13:18:57 +00:00
Eike Ziller
6e7bb28f09 Tr: Add missing full stops
Change-Id: I2debc56d0740eaa30c7d597eae18910f319c1d98
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-05-26 13:50:18 +00:00
Cristian Adam
c1cdea2661 CMakePM: Consider quoted file names for file operations
It is not uncommon for projects to use quoted file names, which would
break the new file operation support for CMakeLists.txt files.

Change-Id: I8dc5d6843f1723c5709cef28cf3bf89a5c87ec2a
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-23 16:27:14 +00:00
Cristian Adam
2f04f08611 CMakePM: Remove comment line lexer addition
This brings the lexer back to vanilla CMake version.

The comment arguments were not needed in the implementation of
source file addition / rename / removal operations.

Change-Id: If28b738b9ce93511b109fe09dcd03f42ee07a431
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-23 14:58:27 +00:00
Eike Ziller
bd660aaf27 CMake: Fix setting additional project files for file watching
Amends d8be2491a5

The change above introduced FileApiReader::takeCMakeFileInfos and uses
it to move the information about additional CMake files out of the
FileApiReader. But that now emptied variable was later used to inform
the project about these additional files. So, that broke the automatic
running of CMake when project files (except the toplevel one) changes.
Instead use the list of additional files that now lives in the
CMakeBuildSystem for that purpose.

Change-Id: I1062593029880af9d4c70e72e1bd101d40ad0c00
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-05-08 12:23:10 +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
c2e657bbf6 CMakePM: Allow file rename / remove for QtQuick projects
qt_add_qml_module was not consided when looking for existing project
files.

This would fail when qt_add_executable and qt_add_qml_module were used
with the same target name.

Change-Id: Ib7374a3e1213c23aaf12d100a8817a46d57a4303
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-03 12:20:54 +00:00
Cristian Adam
71b3c6950f CMakePM: Parse the CMake file before adding new / existing files
This way the functionality would work even if autorun CMake is disabled.

Change-Id: I54ab47d72664cb42486b260b895f58d37a885cce
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-03 12:17:57 +00:00
Cristian Adam
874b1133d9 CMakePM: Allow file rename / remove via variables
Lookup any variables found in the target definition function in order to
find the source files.

This works for something like this:

  set(SOURCE_FILES myfile.cpp)
  add_executable(myexe ${SOURCE_FILES})

Change-Id: I8a47ea64b4efa467074f03ed5e1d1d05b2b1bf00
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-02 19:04:39 +00:00
Cristian Adam
5c2b2966e7 CMakePM: Enable "Add Existing Directory"
This works via "addFiles" and it's supported.

Change-Id: I18d193878c9549581a77d74fd8eb9761c4b08271
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-02 19:04:15 +00:00