Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java25
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java1
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties1
3 files changed, 27 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
index a9bd1dcc41b..99908efd71d 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
@@ -145,12 +145,20 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
case "Ninja": //$NON-NLS-1$
runCMake = !Files.exists(buildDir.resolve("build.ninja")); //$NON-NLS-1$
break;
+ case "Unix Makefiles": //$NON-NLS-1$
+ runCMake = !Files.exists(buildDir.resolve("Makefile")); //$NON-NLS-1$
+ break;
default:
runCMake = !Files.exists(buildDir.resolve("CMakeFiles")); //$NON-NLS-1$
}
if (runCMake) { // $NON-NLS-1$
+ console.getOutputStream().write(String.format(Messages.CMakeBuildConfiguration_Configuring, buildDir));
+ // clean output to make sure there is no content
+ // incompatible with current settings (cmake config would fail)
+ cleanBuildDirectory(buildDir);
+
List<String> command = new ArrayList<>();
command.add("cmake"); //$NON-NLS-1$
@@ -339,4 +347,21 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
}
}
+ private void cleanDirectory(Path dir) throws IOException {
+ Path[] files = Files.list(dir).toArray(Path[]::new);
+ for (Path file : files) {
+ if (Files.isDirectory(file))
+ cleanDirectory(file);
+ else
+ Files.delete(file);
+ }
+ }
+
+ private void cleanBuildDirectory(Path buildDir) throws IOException {
+ if (!Files.exists(buildDir))
+ return;
+ if (Files.isDirectory(buildDir))
+ cleanDirectory(buildDir);
+ // TODO: not a directory should we do something?
+ }
}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java
index 96a606d5c1e..18e2f1fddac 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Messages.java
@@ -19,6 +19,7 @@ public class Messages extends NLS {
public static String CMakeBuildConfiguration_BuildingComplete;
public static String CMakeBuildConfiguration_BuildComplete;
public static String CMakeBuildConfiguration_Cleaning;
+ public static String CMakeBuildConfiguration_Configuring;
public static String CMakeBuildConfiguration_NotFound;
public static String CMakeBuildConfiguration_NoToolchainFile;
public static String CMakeBuildConfiguration_ProcCompCmds;
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties
index 462dd39c547..7af6fa76592 100644
--- a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/messages.properties
@@ -12,6 +12,7 @@ CMakeBuildConfiguration_Building=Building %s
CMakeBuildConfiguration_BuildingIn=Building in: %s\n
CMakeBuildConfiguration_BuildingComplete=Build complete (%d errors, %d warnings): %s\n
CMakeBuildConfiguration_BuildComplete=Build complete\n
+CMakeBuildConfiguration_Configuring=Configuring in: %s\n
CMakeBuildConfiguration_Cleaning=Cleaning %s
CMakeBuildConfiguration_NotFound=CMakeFiles not found. Assuming clean.
CMakeBuildConfiguration_NoToolchainFile=No CMake toolchain file found for this target.

Back to the top