forked from qt-creator/qt-creator
CMake: Add QT_INSTALL_BINS to PATH on windows
Add QT_INSTALL_BINS to PATH on windows in the CMake RunConfiguration. This should fix cmake applications using Qt not being able to get started after they were built. Unfortunately this patch is not a great solution: This should be configurable, similar to the "Add libraries to LD_LIBRARY_PATH" checkbox we have for other OSes and build systems. Such a change is unfortunately not acceptable at this stage of the 4.5 branch though. Task-number: QTCREATORBUG-19354 Change-Id: Ic2d568d965e41e3eb875fed8c2e5dd2ba15d2db1 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -64,7 +65,17 @@ const char TITLE_KEY[] = "CMakeProjectManager.CMakeRunConfiguation.Title";
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *target)
|
||||
: RunConfiguration(target)
|
||||
{
|
||||
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
||||
// Workaround for QTCREATORBUG-19354:
|
||||
auto cmakeRunEnvironmentModifier = [](RunConfiguration *rc, Utils::Environment &env) {
|
||||
if (!Utils::HostOsInfo::isWindowsHost() || !rc)
|
||||
return;
|
||||
|
||||
const Kit *k = rc->target()->kit();
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(k);
|
||||
if (qt)
|
||||
env.prependOrSetPath(qt->qmakeProperty("QT_INSTALL_BINS"));
|
||||
};
|
||||
addExtraAspect(new LocalEnvironmentAspect(this, cmakeRunEnvironmentModifier));
|
||||
addExtraAspect(new ArgumentsAspect(this, "CMakeProjectManager.CMakeRunConfiguration.Arguments"));
|
||||
addExtraAspect(new TerminalAspect(this, "CMakeProjectManager.CMakeRunConfiguration.UseTerminal"));
|
||||
addExtraAspect(new WorkingDirectoryAspect(this, "CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"));
|
||||
|
Reference in New Issue
Block a user