1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Sets the CMake CMAKE_BUILD_TYPE define Fixes #807 (#810)

The CMAKE_BUILD_TYPE is added to CMake configuration build, based on the
active launch mode; DEBUG_MODE sets a buildType of "Debug", everything
else sets a buildType of "Release".
Note, the CMake CMAKE_BUILD_TYPE definition is not directly equivalent
to the Launch Bar Launch Mode; there might be a scenario where the user
wants to launch a debug session using the CMake Release build and not
run it. However, for most cases this is probably sufficient.

For Issue CMake projects are ignoring the Launch mode Run/Debug #807.
This commit is contained in:
betamax 2024-09-12 22:15:24 +01:00 committed by GitHub
parent 219f94c82f
commit 3ee0e61eed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.cmake.core;singleton:=true
Bundle-Version: 1.5.500.qualifier
Bundle-Version: 1.5.600.qualifier
Bundle-Activator: org.eclipse.cdt.cmake.core.internal.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,

View file

@ -68,6 +68,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.ILaunchManager;
import org.osgi.service.prefs.Preferences;
public class CMakeBuildConfiguration extends CBuildConfiguration {
@ -161,6 +162,13 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
ICMakeProperties cmakeProperties = getPropertiesController().load();
runCMake |= !Files.exists(buildDir.resolve("CMakeCache.txt")); //$NON-NLS-1$
// Causes CMAKE_BUILD_TYPE to be set according to the launch mode
if (ILaunchManager.DEBUG_MODE.equals(getLaunchMode())) {
cmakeProperties.setBuildType("Debug"); //$NON-NLS-1$
} else {
cmakeProperties.setBuildType("Release"); //$NON-NLS-1$
}
final SimpleOsOverridesSelector overridesSelector = new SimpleOsOverridesSelector();
if (!runCMake) {
CMakeGenerator generator = overridesSelector.getOsOverrides(cmakeProperties).getGenerator();