Add mechanism for registering environment providers, since just
registering the environment as a prefix variable in the macro expander
doesn't really fit the use case of using more than an individual
variable.
Project explorer registers providers for the current build and run
environments.
External tools can refer to a provider by id and then use that as base
environment.
Task-number: QTCREATORBUG-18394
Task-number: QTCREATORBUG-19892
Change-Id: I19fc4dfa8286b2f1e4679c6406f285dcc9514ba3
Reviewed-by: hjk <hjk@qt.io>
Those keys will cause trouble later, so do not allow them.
Change-Id: Ib2f51a469253d9df21c6a77faa47e6e88feadc07
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
We used to set QT_OPENGL, currently set LD_LIBRARY_PATH when qtcreator.sh
is used, and might set other variables in the future,
but these environment modifications should not be passed on
to user applications or when we run tools that are not shipped with
Qt Creator.
For LD_LIBRARY_PATH there already was a hack for
Environment::systemEnvironment.
For environment variables that we might set in main()
in the future, this patch caches the system environment for
Environment::systemEnvironment early before any modifications are made.
The previous hack for LD_LIBRARY_PATH no longer works, since it
used QCoreApplication::applicationDirPath() which cannot be used at that
point in time (before the QApplication has been created). Instead pass
the correct user LD_LIBRARY_PATH directly from qtcreator.sh to
Qt Creator through a command line option, which is cleaner anyhow.
Task-number: QTCREATORBUG-20808
Change-Id: I6674a5e0537e1b37fd7dcbff371b542fa24bce69
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
A empty path segment in LD_LIBRARY_PATH is *not* ignored and treated
as '.' IIRC.
So make sure to not leave a ':' in first place of LD_LIBRARY_PATH or set
an empty LD_LIBRARY_PATH on Linux.
Change-Id: I99ec2e333c6c0205334daf14ac6a2373c6e465ad
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If qmake uses /usr/bin/gcc and the kit is configured to use /usr/bin/gcc-7,
and both reference the same executable, there is no reason to warn.
Change-Id: Ida79fccb97cffb682c1d85d7fa8888d85bf7d6a4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Generates a bit less code in debug mode and is easier to read IMNSHO.
Change-Id: Ib9c0b9a0c058327facff16600a7014207167b050
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Match case of user changed environment variables to the
already defined variables.
Change-Id: Ic012d35faa0822df3523ab642491c9f19051853c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Paths are prepended, so the first one to be added is actually the last
search path.
On a debian machine with system-installed Qt and Qbs, if you execute Qtc
from another instance of Qtc with "Add build library search path" checked,
LD_LIBRARY_PATH has /usr/lib/x86_64-linux-gnu before $BUILD/lib/qtcreator.
This means that the system's Qbs lib will be loaded instead of the one in
RPATH, which is bad (i.e. qbs build fails because it cannot find
$BUILD/lib/x86_64-linux-gnu/qbs/qbs_processlauncher).
Change-Id: Ibe6778ba8a06da1680e034e31a8fee6d9a81c484
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
As LANGUAGE takes precedence on LC_MESSAGES variable sometimes
If LANG is not set to C now en locale really should be used for messages
by gcc. This fixes parsing of gcc header paths and error messages on non-
english locales
Change-Id: I96db16b555b8ff22b041b6e965558b342ef1a378
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Also change path() to use value() so that "Path" as used on Windows
will be found as well.
Task-number: QTCREATORBUG-18958
Change-Id: Ie930f6a6e71c76459cf9d089c225f5b1adf52433
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Extend operations to handle prepend/append which can be optionally
determined by diff(). This allows cleanly implementing
the MSVC toolchain setup.
Amends c7a84634fd
Change-Id: Ida08d8f5e00cf5f78c20ea8d08c531b1ed22c015
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Move duplication check into class and do not duplicate that.
Change-Id: I6fa34fb2e39d47432e87e959d1e5f44d21287bad
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
With this change, tools like Bullseye Coverage that wrap cl.exe are
disregarded. Only true MSVC installation folders are considered now,
which allows using Creator+Qbs with such tools again.
Task-number: QBS-1000
Change-Id: Ifb49b3c032359aa4ba1bc702de0dc3d30d3b6075
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
The iterator needs to be tested against the end() of
the same container.
Change-Id: Ia4d208650d922d529ea074d4cd0eac9f4ac76b87
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
By using some of the infrastructure in Utils::Environment. Due to
wanting to find all cmake executables in PATH and not just the
first one, we need some custom code.
Change-Id: If3161d712b9f6e659450a3d0647f83344e68ba5d
Task-number: QTCREATORBUG-14740
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Benjamin Zeller <benjamin.zeller@canonical.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
The resulting diff contained all the items that were equal as well.
Since the function was unused so far, no real harm was done,
but the function would be useful to have in the debugger.
Change-Id: Ia0b0cea79cfc3ee5442aaf7bb392121590c0f338
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
The cmd shell on windows sets environment variables starting with
a '='.
Task-number: QTCREATORBUG-8716
Change-Id: I3bb5c15b543339f41a4f895c81ed55ac2701b95c
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Do not search the same directory repeatedly when looking for binaries.
Change-Id: I97a722cfa689224cb85cdadfd02e283247f96325
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
It is used e.g. in the RemoteLinux plugin
(via ProjectExplorer::EnvironmentAspect) and should
therefore not assume that it's meant for a host system process.
Change-Id: I9f44f862f133579b65951e43fc1e654c425fd3d7
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This is basically a generalization of HostOsInfo for
a system that might not be the host system. HostOsInfo
is now implemented in terms of the new class.
Prospective use case: Untie Utils::Environment from
the host system.
Change-Id: If333b96674652109fcb0ad79f75aaaf5e86e17e3
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>