Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sets the CMake CMAKE_BUILD_TYPE define Fixes #807 #810

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

betamaxbandit
Copy link
Contributor

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.

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 eclipse-cdt#807.
@betamaxbandit
Copy link
Contributor Author

Manual Test instructions:

Setup host and Eclipse according to:
https://github.com/eclipse-cdt/cdt/blob/main/cmake/org.eclipse.cdt.cmake.ui.tests/manualTests/Bug579242_manual_tests.md#setup--prerequisites

Create a CMake project

  • In Eclipse, choose File > C/C++ Project.
  • In the New C/C++ Project wizard, choose CMake in the left hand side sash and then CMake Project and click Next.
  • Enter a project name, for example helloworld and click Finish.

In the Launch Bar, select the Local Launch Target.

Test 1: Launch Mode "Run" causes a CMake "Release" build:
In the Launch Bar Launch Mode, select Run.
In the Launch Bar, click Build.
The Console shows build activity

  Configuring in: C:\Users\betamax\cdt-only2\runtime-New_configuration_CDT2\cmake_hw\build\default
  cmake -G MinGW Makefiles -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON C:\Users\betamax\cdt-only2\runtime-New_configuration_CDT2\cmake_hw
  ...

Expected result: the presence of "-DCMAKE_BUILD_TYPE=Release"

Test 2: Launch Mode "Debug" causes a CMake "Debug" build:
In the Launch Bar Launch Mode, select Debug.
In the Launch Bar, click Build.
The Console shows build activity

Configuring in: C:\Users\betamax\cdt-only2\runtime-New_configuration_CDT2\cmake_hw\build\cmake.debug.win32.x86_64
cmake -G MinGW Makefiles -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON C:\Users\betamax\cdt-only2\runtime-New_configuration_CDT2\cmake_hw
...

Expected result: the presence of "-DCMAKE_BUILD_TYPE=Debug"

@ewaterlander
Copy link
Contributor

ewaterlander commented Jun 5, 2024

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.

In the launch configuration the user should be able to override the build type with the additional CMake arguments. But I see an issue that the additional arguments are not added at the end, but before CMAKE_BUILD_TYPE is set based on the launch mode.

I uploaded patch #814 for this.

@jonahgraham jonahgraham merged commit 3ee0e61 into eclipse-cdt:main Sep 12, 2024
5 checks passed
@betamaxbandit betamaxbandit deleted the issue807 branch January 14, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants