Bill Hoffman wrote:
Tyler Roscoe wrote:
On Fri, Dec 19, 2008 at 01:33:45AM +0800, Kermit Mei wrote:
c++ -Wall -gstabs(or -g)  main.cpp hello.cpp -o main

How can I use cmake to do the same thing?

Add your -g flag to CMAKE_CXX_FLAGS or I think you can use
ADD_DEFINITIONS("-g").


It would be better to edit the CMAKE_CXX_FLAGS_DEBUG cache variable.

add_definitions(-g) is bad for a several reasons...

It will break for compilers that do not accept -g, it will add -g to release and optimized builds.

-Bill
hello, I use CMAKE_CXX_FLAGS_DEBUG like this:

cmake -DCMAKE_CXX_FLAGS_DEBUG="-g" CMAKE_INSTALL_PREFIX=/usr ..

But the result is:

This GDB was configured as "i486-linux-gnu"...
(gdb) b main
Breakpoint 1 at 0x80487b3
(gdb) r
Starting program: /home/kermit/Project/FreeRecite/build/bin/FreeRecite-core

Breakpoint 1, 0x080487b3 in main ()
Current language:  auto; currently asm
(gdb) n
Single stepping until exit from function main,
which has no line number information.


It is obvious that the debug information haven't been included. Why?
Is there something wrong when I use the cmake command?

Thanks.
Kermit

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to