Commit Graph

1948 Commits

Author SHA1 Message Date
Tobias Hunger
a90b1c26b1 CMake: Remove CMakeProject::buildTargetTitles
The only user can also get this information from the relevant
CMakeBuildConfiguration.

Change-Id: I80e176ef0a8bc427f6adbf75b20e29f38d7b949f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-12 14:23:58 +00:00
Eike Ziller
dbfa55f5fc CMake: Do not run GUI CMake tool on macOS
We may neither run "/some/path/CMake.app" nor
"/some/path/CMake.app/Contents/MacOS/CMake",
so add a missing workaround for the latter, and use the "resolved"
executable path for the retrieval of version info and capabilities.

Change-Id: I6fed8cc478c0d0b9946a934fd83126e157bde992
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-12 13:52:25 +00:00
Eike Ziller
42ea10892c CMakeTool: Fix disabling of "Autorun" property
Could no longer unset "Autorun" for CMake tools. Broke in
de6faa0f15

Change-Id: I0b6e9e64de591e1128ff0dabf4eedb40e1a3748c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-08-12 12:54:39 +00:00
Eike Ziller
ff503740ce Run CMake via canonical path instead of warning
Running CMake via a non-canonical path (including '..' in the path, or
via a symlink) can result in funny errors.

de6faa0f15 added a warning for that
condition. Unfortunately the auto-detection of CMake can return a path
to a symlink (e.g. for CMake from brew on macOS). Also it is helpful to
use a symlink to e.g. manage different CMake versions.

Instead of warning about the condition, and forcing the user to resolve
it manually, simply run CMake via its canonical path when actually
running it from Qt Creator.

Change-Id: I95623b45c5436a6d61c1419b7aba23e2a73a0650
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-08-12 12:54:28 +00:00
Eike Ziller
b61a5b759b CMake: Remove unused function
Change-Id: I6b793e0cb01b989f3087dcefe091b77bcfebe370
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-08-12 12:54:19 +00:00
Tobias Hunger
eb2f49c398 CMake: Fix race/crash on project open
When the filesystem scan takes longer than the cmake parsing, then
resetData() was called on BuildDirManager by the CMakeBuildConfiguration
before the CMakeProject had requested its data.

Move some code back into CMakeProject to resolve this issue.

Change-Id: Ib21bdd63fdca79c2ad39a7e060df438b456700b4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-09 13:08:11 +00:00
Tobias Hunger
09530d6dcc ProjectExplorer: Use RAII pattern for parsing start/stop signalling
Change-Id: I13de537140f265db3e3d0ab1cd924d6897cd90c8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-09 12:45:29 +00:00
Tobias Hunger
8868989d5c CMake: Fix CMakeCache.txt file detection
QFileInfo::exists(QString) is a static method, so the code was
looking for "CMakeCache.txt":-/

Change-Id: Ib0f9711a159fca9437ffb15c26af246ec69489ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-09 12:43:23 +00:00
Tobias Hunger
200b04f9ca CMake: Simplify setting up a new reader
There is no need to reset a reader when e.g. the build directory changes
when the server-mode reader is *not* used. So the one case where having
separate reparse-options for the case where the reader changes and the
case where it stays the same is bogus.

So unify the flags into one set and simplify the code accordingly.

Change-Id: I9bcfcc6333d574d49513ef1256a9a8597bda4ec7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-09 12:43:14 +00:00
Tobias Hunger
d880f1f771 ProjectExplorer: De-virtualize knowsAllBuildExectuables method on Project
Just use a setter instead.

Change-Id: Id5dff64e9a7fcdf64a245b71432318299a49d9f7
Reviewed-by: hjk <hjk@qt.io>
2019-08-09 12:42:53 +00:00
Tobias Hunger
87f496d091 CMake: More logging of cmake parsing flags
Add more logging of cmake parsing flags as cmake runs are requested
in the plugin.

Change-Id: I5231bd29dfeb6521218dc28c26a5b658ccb4059b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-09 11:52:26 +00:00
Tobias Hunger
afc1b854eb CMake: Remove useless code
Change-Id: I2e4e5f834f99e2c14e0f81c106abec2c1e0a3a87
Reviewed-by: hjk <hjk@qt.io>
2019-08-09 09:24:34 +00:00
hjk
c6f00e1dd2 Unification of desktop run configurations, step 6
Move special CMake environment modification to CMakeBuildConfiguration.

Change-Id: I27f886db48d8c036f2f77f5ae8f239b405cb5721
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-08 15:20:21 +00:00
hjk
07a918c89a Unification of desktop run configurations, step 1
First step, move {DesktopQt,Qbs,CMake}RunConfiguration{,Factory}
into the same new files.

This only moves down to QtSupport, not ProjectExplorer, as there
are in all three cases direct dependencies on QtSupport. Long term
I would expect them to move further down.

Change-Id: Ib16b19df7f3f642ed7f7db89a1f6904601d976ba
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-07 10:35:41 +00:00
Tobias Hunger
70b8fa352a CMake: Remove legacy code from before version 3.7
Change-Id: I8f8c0136548230e755a939d8c1bdfa78f5a644bc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-06 12:48:27 +00:00
Tobias Hunger
ac091622e4 CMake: Move code from CMakeProject into CMakeBuildConfiguration
Move code closer to the BuildDirManager that was moved into the
CMakeBuildConfiguration.

Change-Id: I21d7188e4a3b03a02b12b01c7dd3e46754d653f8
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:49:06 +00:00
Tobias Hunger
338a7184a5 CMake: Move builddirmanager into CMakeBuildConfiguration
Change-Id: I1854b6021e7d573abd4ac9d64c8d5dbd0618ed71
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:48:57 +00:00
Tobias Hunger
8c34d653be CMake: Fix WS
Change-Id: I2558ae2f69c67a039aea96200878b056ed391ed7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-08-05 15:44:08 +00:00
Tobias Hunger
de6faa0f15 CMake: Better warnings for strange/invalid CMake binaries
Warn when cmake is configured to use a non-canonical path. This might
trigger problems in CMake itself.

Show this warning in the Kit as well as in the CMake options page.

Also complain other issues in the CMake options page.

Task-number: QTCREATORBUG-22583
Change-Id: I841341db8305f9152543487ce9ceeab2eca0b2b9
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:13:40 +00:00
Tobias Hunger
0b493a351e CMake: Fix WS
Change-Id: I5bd56e994c5aacc0c4086c4eae1242b2d977a2ec
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:11:24 +00:00
hjk
16b9a47e83 ProjectExplorer: Replace Project::projectConfigurationChanged
... by a Project::buildConfigurationChanged. That's the only case
used, and saves filtering on the receiver side. Also, the passed
bc is (in non-null) the active one, so isActive checks are not
necessary.

The null case seems to be only possible to trigger when removing
the currently active build configuration manually i.e. happens rarely,
so having it trigger an unneeded final display update on the dying
build config is tolerable, so drop the null check in such cases
to achieve a more uniform pattern.

Change-Id: I46f72e9e277767214dbd6920dd86b026a7084f46
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-02 13:59:31 +00:00
hjk
dcb892cf39 Update build step widgets only on changes to the owning build config
Updating on changes to other build config seem excessive, as the
updated details only depend the owning build config.

Change-Id: Iba86f2b56033ac55381d452dd2a435e5dda72674
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-02 11:20:45 +00:00
hjk
7d3091a7b9 ProjectExplorer: Remove ProjectConfiguration base from Target
Targets are different from {Run,Build,Deployment}Configurations,
both regarding the level in the ProjectExplorer hierarchy, and
also by the set of supported operations (e.g. aspects).

Change-Id: Ia8490e2280a9ecc518395c5e48ce2fd5d6d58fd2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-31 11:18:16 +00:00
Eike Ziller
7de82409fc Merge remote-tracking branch 'origin/4.10'
Change-Id: I7a7bc552e09de1fbee98402c97e3a35f0e2c952a
2019-07-31 08:27:20 +02:00
Tobias Hunger
86c4416af6 CMake: Handle environment changes in cmake better
Handle environment changes in cmake better.

Server-mode will trigger an reader-change when the environment changes.
This has not been considered so far and a reader-change triggered by
an environment change was considered an error (and ignored).

Change-Id: I2d0baadbcfc86e04348c75d8e5997817bdc233a5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-30 15:38:19 +00:00
Tobias Hunger
f9c246b26e CMake: Request filesystem scan when cmake files change
The typical use case is to add header/source file and then update
the CMakeLists.txt file to add the source.

Request a filesystem scan when a cmakefile changes to pick up the
header file when the source file is added.

Task-number: QTCREATORBUG-22674
Change-Id: Ifbb1ba37dd46967215f51db2c6ad92af669df585
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-30 15:38:04 +00:00
Tobias Hunger
16fe5fe109 CMake: Simplify reparsing logic
Do not overload the "new reader" logic with the logic for "no CMakeCache.txt"
file.

This makes it a bit simpler to reason about the different conditions when the
options are applied.

Note that "no CMakeCache.txt" is handled later anyway by adding the
"REPARSE_FORCE_CMAKE_RUN" flag.

Change-Id: Icc9455152053911cc839a19c76d3c0e44fc76fcf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-30 15:37:53 +00:00
Tobias Hunger
6e49f78b13 CMake: Select better default target when a buildstep's target is no longer found
Select a better fallback target when a buildstep's target is no longer defined.

This change was cherry-picked from master branch:
9519f125e9

Change-Id: I7ef27361793125258cd2a73448d91d2561db5901
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 12:16:30 +00:00
Tobias Hunger
cf65db29e7 CMake: Update target list in build step list widget
Update the target list in the build step list widget for CMakeBuildSteps,
even when "current executable" meta-target is selected.

This change was cherry-picked from master branch:
ce7407dc03

Change-Id: Ifc1d8dc67894202eb38fe6088552797b198c7463
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 12:16:20 +00:00
Tobias Hunger
9481845293 CMake: Add helper method to find the default build target for a BuildStep
Add a helper method to find the default build target for a CMakeBuildStep
based on the BuildStepList the step is part of. Use all/install/clean
targets as appropriate.

This change has been cherry-picked from master branch:
8b9821440d

Change-Id: Idc0c5fae7dfd255039b87ace77c02688cdd76e8f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 12:16:10 +00:00
Tobias Hunger
f9659211ac CMake: Fix target names for "current executable" selection
This patch is not applicable to the master-branch: The buildkeys
for cmake targets have changed there.

Task-number: QTCREATORBUG-22634
Change-Id: I1c8abc42792a004bdadc893129c96e1b7ed428f6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 12:15:57 +00:00
Tobias Hunger
02e224fcfa CMake: Support CMAKE_CURRENT_LIST_DIR and CMAKE_CURRENT_SOURCE_DIR
Support CMAKE_CURRENT_LIST_DIR and CMAKE_CURRENT_SOURCE_DIR as
variables in filenames when handling links in the CMake editor.

Having a way to find out variable values in CMake would be nice,
till that arrives, we have to live with hacks to make the most
common variables work:-/

Task-number: QTCREATORBUG-21065
Change-Id: Iffaaae8665e0662226d08b88de37b66d5a5fc4d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-07-29 08:47:08 +00:00
Tobias Hunger
4aee38e04c CMake: Extract and show more CMake location information for targets
Report more cmake file locations that are relevant to a target in
the "Open..." menu entry in the target's context menu.

This information is extracted from the backtrace information that
is provided by fileapi.

Change-Id: I01659a6cc7254cd0ef6b533a0785d2f15d31c3c6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-07-29 08:46:53 +00:00
Tobias Hunger
9ae4510e27 ProjectNodes: Use QVector instead of QList for LocationInfo
Change-Id: I5bad9e1849b9d752de24626013c9102242d11a0a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-29 08:45:08 +00:00
hjk
a6c85993ba ProjectExplorer: Propagate build environment changes more directly
To check this still works I used a CustomRunConfiguration with
a executable name $AAA, the tooltip there tries to expand that
(and complains that $AAA is not an executable).

By inserting a AAA=/bin/ls in the build environment, the tool tip
on the run config exectable path chooser changes appropriately,
same for changing the AAA value.

The connection seems also needed, dropping it destroys that updating.

Change-Id: I28965cbd3ce530a83d98808ca7624a6799cd9800
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-26 12:05:52 +00:00
Tobias Hunger
4daba5a9fa CMake: Fix working directory for targets in fileapi mode
Prepend the full path to the build directory.

Change-Id: I55111b656fd4b99ee68517c09117f142e88947b1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-26 11:49:01 +00:00
Tobias Hunger
eab0df22f9 CMake: Make fileapi not race against its own reply file detection
Fix broken logic to prevent CMake fileapi from detecting the change
its own cmake run triggered via file watching.

Remember the last file that was parsed and do not attempt to parse
this again. Remember the file on a per-project basis, too:-)

Change-Id: Ia6e155b65d77994f6e3d2a3677f770a4ba53539d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-25 13:32:21 +00:00
Tobias Hunger
ec92784778 CMake: Report absolute paths to executables in fileapi mode
Task-number: QTCREATORBUG-22610
Change-Id: Ib6abf1ce6d94abd9dc063f4f559f02f2d4ea8798
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-25 13:19:11 +00:00
Christian Kandeler
939df1c493 CmakeProjectManager: Fix warning about redundant std::move()
Change-Id: If456698d62c0bdcd51992d62510e07d00a4b3fdf
Reviewed-by: hjk <hjk@qt.io>
2019-07-25 12:45:11 +00:00
Tobias Hunger
d9cf17bbda CMake: Add locator filter to open CMake target definitions
Add a "cmo" filter to the locator that will open the CMake target
definition in the editor.

Note that this is based on the target data extracted from cmake. For
tealeaf-reader and server-mode this information is guessed based on
the targets source directory (plus CMakeLists.txt). These modes will
just open that file.

For fileapi the information is accurate and based on the backtrace
that comes with the target information. "cmo" will open the exact
file/line from the backtrace here.

Task-number: QTCREATORBUG-18553
Change-Id: I4ee0eb25d1d763bd0d8033e506bf85cb2bc1f2dc
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-25 12:22:05 +00:00
Tobias Hunger
b06f235989 CMake: Report extra information of cmake in tooltip
Report version information as well as support for fileapi and
server-mode in a tooltip you get by hovering a cmake version in
Tools->Options->Kits->CMake.

Change-Id: I2c4070b0b26eb4a056925ac5e10774e93ad62c46
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-25 12:15:51 +00:00
Tobias Hunger
6790238d91 CMake: Do not warn when fileapi-enabled cmakes have no Codeblocks
Do not warn when fileapi-enabled cmake tools do not have the
Codeblocks extra-generator set in the Kit. This is only necessary
for the tealeaf-reader.

Change-Id: Id3aa9df2ec5aa8c2de8b0a5bef8c751e54d72b42
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-25 12:15:40 +00:00
Tobias Hunger
551d876db3 CMake: Fix fileApi detection
Fix fileApi detection: It returns a list of versions in -E capabilities
output, not just one version.

Change-Id: I94a59806f3c4577b01342cae6f05cdc8385131a8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-25 12:15:32 +00:00
Tobias Hunger
35bb768f4a CMake: Make CMakeParser work again
The CMakeParser used to set relative paths in the Tasks it creates.
Since is problematic: Task tries to match that relative file name to
one of the files that exist in the session.

At the time cmake runs only the top-level CMakeLists.txt file is known,
so this logic will map all the relative file paths to that file.

Make sure to write absolute file paths into tasks so that this mapping
is not attempted.

Change-Id: I4ab72df21f18d2eff27ca9a502d605e00df2ad85
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-25 09:13:39 +00:00
Tobias Hunger
12dea8f772 CMake: Store more information in CMakeTargetLocationFilter
Change-Id: I8bca4d6b591ccdf890c971e86e2e43dbf859eb44
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-25 09:12:58 +00:00
Tobias Hunger
979b0463e8 CMake: Split up cmake's locator filter
Split up CMake's locator filter into a part that contains all
the logic to find targets and a part that handles the action.

This is so that the code used to search for targets can be reused
later.

Change-Id: Ife6c9fe6a6f1955bedaa1b9298630c052e17c33f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-24 14:58:13 +00:00
Tobias Hunger
efc89ff60d CMake: Rename CMakeLocatorFilter to CMakeTargetLocatorFilter
Make virtual function implementations final while touching the file.

Change-Id: I94c44ee3efbc9beb39789dd198ee607791a9a44d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-24 14:57:59 +00:00
Tobias Hunger
69b3d90683 CMake: Remember file location of CMake target definitions
Make fileapi remember where CMake targets were defined in the
CMakeBuildTarget struct. The other readers will just guess at
the location based on the source directory of the target.

Change-Id: Ia8fa226c548800992ccea64b1d5981d2f3013408
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-24 14:57:47 +00:00
Tobias Hunger
7c63c2fdc7 CMake: Remove unused member variable of CMakeProject
Also remove a stray comment that is no longer applicable.

Change-Id: I052f458f8cfdfb921249b3f3d7c33cccc2aef371
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-24 13:37:43 +00:00
Tobias Hunger
9519f125e9 CMake: Select better default target when a buildstep's target is no longer found
Select a better fallback target when a buildstep's target is no longer defined.

Change-Id: I7ef27361793125258cd2a73448d91d2561db5901
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-24 08:56:32 +00:00