Commit Graph

37 Commits

Author SHA1 Message Date
Christian Stenger
ca04d9afcd CMakePM: Fix compile for gcc 7
Due to a compiler bug the content of the raw string is
handled inside the preprocessor and the cmake comments
end up as being noticed as unknown preprocessor directives.

Change-Id: I3f235cfdd0799a6bb94743e2910663d9b0d3385d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-04-28 09:53:09 +00:00
Alessandro Portale
b2b6c64e6a Don't detach temporary containers
Change-Id: I736cfc61c81995a81b056b3e3e5703ded5912525
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-02-24 08:27:10 +00:00
Cristian Adam
ad2155d793 CMakeProjectManager: Add compiler for Visual Studio / Xcode imports
Visual Studio / Xcode generators are not setting the CMAKE_C|XX_COMPILER
variables, and when importing such a build the generated kit will have
no
compilers and won't be much of a use.

Luckily CMAKE_LINKER has the path to link.exe / ld, which is the same
path for the compiler cl.exe / clang.

Change-Id: Id21bb0ec2d5aa6ab5a185e03992477c433ac4798
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-02-11 17:38:50 +00:00
Cristian Adam
6cbdae8070 CMakeProjectManager: Support for multi-config generators
CMake has multi-config generators like:

  * Visual Studio
  * Xcode
  * Ninja Multi-Config

The first two have different special targets for "all", "install",
"package", "test" namely: "ALL_BUILD", "INSTALL", "PACKAGE",
"RUN_TESTS".

All of them need to get the build type passed via "--config <build-
type>" and not via "CMAKE_BUILD_TYPE".

The multi-config generators will use only one build directory.

Fixes: QTCREATORBUG-24984
Change-Id: I8aa7ff73ce2af1e163b21a6504d26fcf95530edf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-21 09:31:30 +00:00
Cristian Adam
707a3cfaf3 CMakeProjectManager: Use CMAKE_HOME_DIRECTORY as source directory
The CMakeCache.txt file has CMAKE_HOME_DIRECTORY pointing to the
project source directory used to configure the project.

When importing a cmake build the CMAKE_HOME_DIRECTORY from
CMakeCache.txt might not point to the same CMakeLists.txt that was
opened as a project.

qt-cmake-standalone-test from Qt6 uses a CMake template project which
does a add_subdirectory with the test source directory, which will not
work if opened standalone.

Normally this is a user error though, so ask the user if this was
intended, before actually importing the build.

Task-number: QTBUG-88776
Change-Id: Ifdd5e1d1cb8a1ef9955d22493eba3a1a55dc689f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-01-08 16:25:24 +00:00
Cristian Adam
d3595110f1 CMakeProjectManager: Fix importing Qt6 projects
The code that detected the qmake path for the project stopped
working with Qt 6.0.

The new code will run a small CMake project that will output
the path of qmake from the CMake world, and not something that
Qt Creator does from outside.

Fixes: QTCREATORBUG-25100
Change-Id: I9071648c2e60eb89d0dc8f08aed793167b42a365
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-06 17:10:13 +00:00
hjk
c427a0d281 CMakeProjectManager: Code cosmetics
Change-Id: I102f0c6104a36b0637e7e713ab4b06b2b97984fc
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-01-04 12:55:12 +00:00
Cristian Adam
4ae5516453 CMakeProjectManager: Use canonical paths for compiler match import
On Linux (Ubuntu 20.04) Qt Creator would use /usr/bin/g++ as
compiler for C++. CMake would pick /usr/bin/c++ as C++ compiler.
Both of them are symlinks to /usr/bin/x86_64-linux-gnu-g++-9

There is no need to create imported kits for something which
is the same compiler.

Fixes: QTCREATORBUG-25069
Change-Id: I90e0f7b1977ace3f7995ce09f4b3fcfa64d02b72
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-12-11 16:17:30 +00:00
Cristian Adam
5b1cff753a CMakeProjectManager: Match only on Cxx and C languages on import
This way Qt Creator won't be creating imported kits on every import.

On Windows the language "RC" is not part of the kit languages and
would always discard valid matching kits.

Fixes: QTCREATORBUG-25069
Change-Id: Ib4ec323ebf514c82e5036f7d0123100a75f3ea10
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-12-10 08:20:53 +00:00
Eike Ziller
2a05186194 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	CMakeLists.txt

Change-Id: I799060da2cb299bb0c49a3da3530fad18427a23c
2020-08-21 10:08:55 +02:00
Wojciech Smigaj
795ccfbffc CMake: Register CMake tools detected while scanning build directories
Fixes: QTCREATORBUG-24502
Change-Id: Idf96e666e783edbf8b0fbe4216affb80b0464104
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-08-20 21:11:33 +00:00
Eike Ziller
9df06af9bd CMake: Fix comparison of source paths when importing
We need to check canonical paths with canonical paths.
Otherwise we get a mismatch when using e.g. a linked directory for the
source path on the command line and then try to import the build in Qt
Creator.

Change-Id: I153be74b6cfdf5070e023780604ce64c92df0e6d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-08-18 12:24:15 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
Tobias Hunger
b321f54186 CMake: Update log output of CMake Project Importer
Change-Id: I18c6890ecad58d6e078492af30c5509d9db766f9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-18 14:13:56 +00:00
Tobias Hunger
054f5617f8 CMake: Make import of build directories using Qt 6 work
Make import of build directories using Qt 6 work. This assumes that
Qt 6 will use the same layout as Qt 5 and that there is qmake (which
is assumed everywhere in Creator right now).

Change-Id: I37194b186127befb3df32ebacf86c032c71ef18a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-18 14:13:43 +00:00
Tobias Hunger
59473389b9 CMake: Remove BuildDirManager
The BuildDirManager was used to switch between different
BuildDirReaders. Now that only the FileApiReader is left, that
infrastructure is no longer needed.

Change-Id: I2d339a3407bb633cff6a8f7502b7b09094f63fef
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-04-30 12:08:08 +00:00
Tobias Hunger
5350288e45 CMake: Fix includes all over the CMake plugin
Keep internals internal, remove some unnecessary includes, add
some that should have been there.

This reduces the number of files that get rebuild when working
on CMake internals from over 1000 to about 200.

This patch also moves some code around that ended up being
in the wrong file.

Change-Id: Icd7366ac760dc85031040720418fbb16336dce9b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-04-20 10:05:24 +00:00
Alessandro Portale
9904464074 Make various Q_LOGGING_CATEGORY's static
Change-Id: I43d3a198b0863d85a7fb305c7cb768f68acbd139
Reviewed-by: hjk <hjk@qt.io>
2020-01-15 14:54:10 +00:00
hjk
b4ee6eb3c0 ProjectExplorer: Move some of the BuildInfo setup code to central places
Change-Id: I8893366acb187ea1a94a8ca272ded2c46cb521d1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-14 13:56:10 +00:00
hjk
1eaf44a270 ProjectExplorer: De-QObject-ify BuildConfigurationFactories
The QObject was not heavily used. Object name was for debugging only,
translation context can be taken from the corresponding BuildConfiguration
objects, the qobject_casts in the three big importers are replaced by
dynamic_cast, which is good enough in that context.

Take the opportunity to re-use translations from base BuildConfiguration
for the common cases and sprinkle in some 'final'.

Change-Id: I8e9727c98c6e943cb333556861c24e701c2bdf45
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-10 12:46:38 +00:00
hjk
2b7fab1668 ProjectExplorer: Promote CMakeToolChainData to a global structure
... and use it in ToolChainFactory::detectForImport() overloads.

Change-Id: I107b9d5e185580b8fbef4c6e0233fdae5d253506
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-04 10:34:58 +00:00
hjk
e7c6169d70 ProjectExplorer etc: More FilePath usage
Mostly for project files.

Change-Id: Icb6059f80758865e42cc9f9c092ec6782770dfd7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-26 16:02:23 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
hjk
0595e67c82 More FileName::pathAppended()
Change-Id: Ie20ec34ea9712b3ec49e6233b23cef84c2019f03
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-20 14:37:13 +00:00
hjk
36daca80f3 Utils: Make FileName::canonicalPath a member
Change-Id: I8d7450dec5c4c14ae3e007d1d66f1a9c3c98f807
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-20 11:06:12 +00:00
hjk
f4c9e5e5c4 More FileName::appendPath() -> .pathAppended()
Change-Id: I403d34e4f52f758339c158efc7a11fd329e3e043
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 11:55:04 +00:00
Christian Kandeler
83dd031960 ProjectExplorer: Rename KitInformation to KitAspect
The name "KitInformation" does not properly convey the fact that it
represents a certain *aspect* of a kit. The same goes for
"KitConfigWidget", which in addition was inconsistent with
"KitInformation".
We now use "KitAspect" and "KitAspectWidget".

Change-Id: I9804ee4cedc4d61fad533ea1dd4e4720e67fde97
Reviewed-by: hjk <hjk@qt.io>
2019-02-11 11:55:01 +00:00
hjk
54c2dff181 {C,Q}MakeProjectManager: Simplify buildInfoListForKit implementations
In both cases the created lists contain at most one item, no need to check
for duplicates.

Change-Id: Ibd2cb100d4c4199e65ffc62678e255c8ab41b11c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-30 16:55:44 +00:00
hjk
9bb936499d ProjectExplorer: Collapse BuildInfo hierarchy
... to pass it around as real values, avoiding, among others,
the need of occasional explicit deletion.

The formerly extra members of the derived stuff are handled via
an extra variant (for data) and via a functor in the build
configuration factory.

The change is mechanical.

Change-Id: I19ca4e0c5f0a5b196fc16dfb98bb005dc679f855
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-30 16:51:05 +00:00
hjk
070e0efdcc ProjectExplorer: Rename IBuildConfigurationFactory
... to BuildConfigurationFactory. It hasn't been an Interface for a
while and the new name matches Run- and DeployConfigurationFactory

Change-Id: I923c6a27e18a99628251b69e0270e910836e7b2a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-29 11:38:31 +00:00
Alessandro Portale
17f169c291 CMakeProjectManager: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using

Change-Id: I6a272bc3b75835840b3d6cbe83be6f50f94bbedb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-25 07:50:15 +00:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00
Tobias Hunger
02533e61cf CMake: Fix project parsing notification
This builds on top of 08677c0b01 and
fixes one more code path to go through a common entry/exit point.

Change-Id: I1d00fa9242f247028e5d3b0ef3b5fe1d3f4cb03d
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-06 09:53:40 +00:00
Tobias Hunger
eb8075f569 CMake: Compare canonical paths when checking source directory
Compare the CMAKE_HOME_DIRECTORY to the canonical project paths during
cmake project import. CMake makes sure to store the canonical path
there.

Change-Id: I4ae3ad1f8fab66a50ba98d4266c78cdb4d21f2ea
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-04-25 15:31:06 +00:00
Tim Jenssen
2631ffabd5 Remove spaces in initializer lists
Format initializer lists code style like.

Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013
Reviewed-by: hjk <hjk@qt.io>
2017-02-22 16:25:09 +00:00
Tobias Hunger
4f40d7778d CMake: Introduce project importer for cmake projects
Change-Id: Ie215e1c3f0286f6d98d10865e2b0a16b01391cd5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-10 10:34:07 +00:00