1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 536363 - Meson project include paths wrong when using ccache

- fix GCCToolChain and ContainerGCCToolChain to not blindly
  take the first token in the command string when processing
  scannerinfo; if it is "ccache", take the second token instead

Change-Id: I4b2b7dfaccae6f3ec968bbe4217c57994ad71963
(cherry picked from commit a5ed8ea2a4)
This commit is contained in:
Jeff Johnston 2018-07-04 17:03:29 -04:00
parent a1ed9cdb39
commit ee5f57d536
2 changed files with 19 additions and 4 deletions

View file

@ -256,7 +256,14 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
try {
Path buildDirectory = Paths.get(buildDirectoryURI);
Path command = Paths.get(commandStrings.get(0));
int offset = 0;
Path command = Paths.get(commandStrings.get(offset));
// look for ccache being used
if (command.toString().contains("ccache")) { //$NON-NLS-1$
command = Paths.get(commandStrings.get(++offset));
}
List<String> commandLine = new ArrayList<>();
if (command.isAbsolute()) {
commandLine.add(command.toString());
@ -283,7 +290,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
}
addDiscoveryOptions(commandLine);
commandLine.addAll(commandStrings.subList(1, commandStrings.size()));
commandLine.addAll(commandStrings.subList(offset + 1, commandStrings.size()));
// Strip surrounding quotes from the args on Windows
if (Platform.OS_WIN32.equals(Platform.getOS())) {

View file

@ -186,7 +186,14 @@ public class ContainerGCCToolChain extends PlatformObject
try {
Path buildDirectory = Paths.get(buildDirectoryURI);
Path command = Paths.get(commandStrings.get(0));
int offset = 0;
Path command = Paths.get(commandStrings.get(offset));
// look for ccache being used
if (command.toString().contains("ccache")) { //$NON-NLS-1$
command = Paths.get(commandStrings.get(++offset));
}
List<String> commandLine = new ArrayList<>();
if (command.isAbsolute()) {
commandLine.add(command.toString());
@ -213,7 +220,8 @@ public class ContainerGCCToolChain extends PlatformObject
}
addDiscoveryOptions(commandLine);
commandLine.addAll(commandStrings.subList(1, commandStrings.size()));
commandLine.addAll(
commandStrings.subList(offset + 1, commandStrings.size()));
// Strip surrounding quotes from the args on Windows
if (Platform.OS_WIN32.equals(Platform.getOS())) {