1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

Fix up handling of Qt build config defaults.

Don't rely on default properties any more. Make sure we can handle
the cases when the properties are null.

Change-Id: I8b359891286118553399e7635d2ea4b7f147892a
This commit is contained in:
Doug Schaefer 2017-10-16 15:06:37 -04:00
parent 48d5342815
commit 6f06e634c4

View file

@ -144,6 +144,7 @@ public class QtBuildConfiguration extends CBuildConfiguration
if (launchMode != null) { if (launchMode != null) {
settings.put(LAUNCH_MODE, launchMode); settings.put(LAUNCH_MODE, launchMode);
} }
try { try {
settings.flush(); settings.flush();
} catch (BackingStoreException e) { } catch (BackingStoreException e) {
@ -462,48 +463,18 @@ public class QtBuildConfiguration extends CBuildConfiguration
buildCommand[0] = command.toString(); buildCommand[0] = command.toString();
} }
return buildCommand; return buildCommand;
} else {
Path command = findCommand("make"); //$NON-NLS-1$
if (command == null) {
command = findCommand("mingw32-make"); //$NON-NLS-1$
}
if (command != null) {
return new String[] { command.toString() };
} else { } else {
return null; return null;
} }
} }
@Override
public Map<String, String> getDefaultProperties() {
Map<String, String> defaults = super.getDefaultProperties();
String qmakeCommand = qtInstall.getQmakePath().toString();
defaults.put(QMAKE_COMMAND, qmakeCommand);
String qmakeArgs;
String launchMode = getLaunchMode();
if (launchMode != null) {
switch (launchMode) {
case "run": //$NON-NLS-1$
qmakeArgs = "CONFIG-=debug_and_release CONFIG+=release"; //$NON-NLS-1$
break;
case "debug": //$NON-NLS-1$
qmakeArgs = "CONFIG-=debug_and_release CONFIG+=debug"; //$NON-NLS-1$
break;
default:
qmakeArgs = "CONFIG-=debug_and_release CONFIG+=launch_mode_" + launchMode; //$NON-NLS-1$
}
} else {
qmakeArgs = "CONFIG+=debug_and_release CONFIG+=launch_modeall"; //$NON-NLS-1$
}
defaults.put(QMAKE_ARGS, qmakeArgs);
String buildCommand = "make"; //$NON-NLS-1$
if (findCommand(buildCommand) == null) {
buildCommand = "mingw32-make"; //$NON-NLS-1$
if (findCommand(buildCommand) == null) {
// Neither was found, default to make
buildCommand = "make"; //$NON-NLS-1$
}
}
defaults.put(BUILD_COMMAND, buildCommand);
return defaults;
} }
@Override @Override