[CMake] How can I add gprof profiler to my CMakeLists.txt?

Water Lin WaterLin at ymail.com
Mon Dec 14 23:08:52 EST 2009


I want to use gprof to analyze my code. So I try to embed the -pg
paramter for g++ in my CMakeLists.txt file.

But after I embeded the -pg to my CMakeLists.txt like this:
---------
add_definitions(-pg -march=pentium4 -msse3 -g)
---------
and I recompile my code. There is no gprof output file.

But when I use command like:
--------
$ g++ -pg ....
--------
to compile my code, gprof will generate a output file gmon.out.

So, how can I enable gprof profiler in my CMakeLists.txt?

Thanks

Water Lin
-- 
Water Lin's notes and pencils: http://en.waterlin.org
Email: WaterLin at ymail.com
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the CMake mailing list