Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDoug Schaefer2017-11-05 17:14:39 +0000
committerDoug Schaefer2017-11-05 17:14:39 +0000
commit69404fdf895d4f8cb0c024cdc9207004d05c95c4 (patch)
tree571d9c102828c7dbb989aa263a3675d7f93cdeb3 /build
parent45fb622c512af22fd77a22d38ac6173c0f571885 (diff)
downloadorg.eclipse.cdt-69404fdf895d4f8cb0c024cdc9207004d05c95c4.tar.gz
org.eclipse.cdt-69404fdf895d4f8cb0c024cdc9207004d05c95c4.tar.xz
org.eclipse.cdt-69404fdf895d4f8cb0c024cdc9207004d05c95c4.zip
CMake - check for build files, clean up some UX.
Starting for Ninja, check for build.ninja file on whether to run CMake again. Need to do same for makefiles. Change default to run cmake --build instead of hardcoding ninja or make. Added message to the end of the build to know when it's done. Change-Id: Ibbb352ef7c64f6e1fcbe122ef0b73f2c91bb1aa7
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java23
-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, 16 insertions, 9 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 31be86178bc..8be3ee22b21 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
@@ -109,7 +109,16 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
outStream.write(String.format(Messages.CMakeBuildConfiguration_BuildingIn, buildDir.toString()));
- if (!Files.exists(buildDir.resolve("CMakeFiles"))) { //$NON-NLS-1$
+ boolean runCMake;
+ switch (generator) {
+ case "Ninja": //$NON-NLS-1$
+ runCMake = !Files.exists(buildDir.resolve("build.ninja")); //$NON-NLS-1$
+ break;
+ default:
+ runCMake = !Files.exists(buildDir.resolve("CMakeFiles")); //$NON-NLS-1$
+ }
+
+ if (runCMake) { // $NON-NLS-1$
List<String> command = new ArrayList<>();
// TODO location of CMake out of preferences if not found here
@@ -155,14 +164,8 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
epm.setOutputStream(console.getOutputStream());
String buildCommand = getProperty(BUILD_COMMAND);
- if (buildCommand == null) {
- if (generator.equals("Ninja")) { //$NON-NLS-1$
- buildCommand = "ninja"; //$NON-NLS-1$
- } else {
- buildCommand = "make"; //$NON-NLS-1$
- }
- }
- String[] command = buildCommand.split(" "); //$NON-NLS-1$
+ String[] command = buildCommand != null && !buildCommand.trim().isEmpty() ? buildCommand.split(" ") //$NON-NLS-1$
+ : new String[] { "cmake", "--build", "." }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Path cmdPath = findCommand(command[0]);
if (cmdPath != null) {
@@ -181,6 +184,8 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
// Load compile_commands.json file
processCompileCommandsFile(monitor);
+ outStream.write(String.format(Messages.CMakeBuildConfiguration_BuildingComplete, buildDir.toString()));
+
return new IProject[] { project };
} catch (IOException e) {
throw new CoreException(Activator.errorStatus(String.format(Messages.CMakeBuildConfiguration_Building, project.getName()), e));
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 e420dab906e..26f166eae40 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
@@ -13,6 +13,7 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.cmake.core.internal.messages"; //$NON-NLS-1$
public static String CMakeBuildConfiguration_Building;
public static String CMakeBuildConfiguration_BuildingIn;
+ public static String CMakeBuildConfiguration_BuildingComplete;
public static String CMakeBuildConfiguration_Cleaning;
public static String CMakeBuildConfiguration_NotFound;
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 d4be3821762..09b418b25be 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
@@ -7,6 +7,7 @@
################################################################################
CMakeBuildConfiguration_Building=Building %s
CMakeBuildConfiguration_BuildingIn=Building in: %s\n
+CMakeBuildConfiguration_BuildingComplete=Build complete: %s\n
CMakeBuildConfiguration_Cleaning=Cleaning %s
CMakeBuildConfiguration_NotFound=CMakeFiles not found. Assuming clean.
CMakeBuildConfiguration_ProcCompCmds=Processing compile commands %s

Back to the top