[CMake] Can't use Visual Studio Debugger with Cmake

Michael Jackson mike.jackson at bluequartz.net
Mon Jul 22 07:57:33 EDT 2013


Beniot, 
  The Visual Studio generator does not care about CMAKE_BUILD_TYPE. You need to set that in Visual Studio Itself. Once you do that you will be able to debug. There is topically a setting in the top toolbar where you can switch between Debug and Release builds.
---
Mike Jackson                 www.bluequartz.net

On Jul 22, 2013, at 5:21 AM, Benoit <benpaka.spam at gmail.com> wrote:

> Hi,
> 
> I have a serious problem to use VS2008 Debugger when I create a project using CMake 2.8.11.1.
> 
> For example I am trying to "debug" the HelloDemo project.
> So I do the following:
> 	• Select Source Folder: C:/Program Files/CMake 2.8/share/cmake-2.8/Example (Example files where available form .zip but not from .exe)
> 	• Select build folder:  C:/Projects/builds/test_hellodemo
> 	• Click on "Configure"
> 	• Specify generator to VS 9 2008 and click Finish
> 	• Set "CMAKE_BUILD_TYPE" to Debug.
> 	• Click on "Generate"
> 	• Open C:/Projects/builds/test_hellodemo/Hello.sln
> 	• Build Solution (F7)
> 	• Set breakpoint on hello.Print() function inside demo.cxx file.
> 	• Start Debugging (F5) > Specify the executable file name by : C:\Projects\builds\test_hellodemo\Demo\Debug\helloDemo.exe
> And then no debugger is launched!
> Below is the output:
> 
> 'helloDemo.exe': Loaded 'C:\Projects\builds\test_hellodemo\Demo\Debug\helloDemo.exe', Binary was not built with debug information.
> 'helloDemo.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
> 'helloDemo.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
> The program '[0x808] helloDemo.exe: Native' has exited with code 0 (0x0).
> 
> Do you have any idea what I am doing wrong! I though setting Build_type to debug was enough!
> The strange thing Is that I have used Cmake with OpenCV two years ago and I don't remind this error!
> 
>  Cheers,
> 
> --
> Benoit RAT
> 
> --
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list