Set<SourceFile> (Project project, CppBinary cppBinary, CppCompile cppCompile) { Set<SourceFile> sources = new LinkedHashSet<>(); for (File file : cppBinary.getCppSource().getFiles()) { sources.add(new SourceFileImpl(file, null)); } if (cppCompile.getObjectFileDir().isPresent()) { File objectFileDir = cppCompile.getObjectFileDir().get().getAsFile(); Iterator<CompilerOutputFileNamingSchemeFactory> it = ((DefaultProject)project).getServices().getAll(CompilerOutputFileNamingSchemeFactory.class).iterator(); if (it.hasNext()) { CompilerOutputFileNamingSchemeFactory outputFileNamingSchemeFactory = it.next(); boolean isTargetWindows = IS_51_OR_BETTER ? cppBinary.getTargetPlatform().getTargetMachine().getOperatingSystemFamily().isWindows() : isWindowsOld(cppBinary.getTargetPlatform()); String objectFileExtension = isTargetWindows ? ".obj" : ".o"; CompilerOutputFileNamingScheme outputFileNamingScheme = outputFileNamingSchemeFactory.create(); outputFileNamingScheme.withOutputBaseFolder(objectFileDir).withObjectFileNameSuffix(objectFileExtension); for (SourceFile sourceFile : sources) { File objectFile = outputFileNamingScheme.map(sourceFile.getSourceFile()); ((SourceFileImpl)sourceFile).setObjectFile(objectFile); } } } return sources; }