I recently started to work on a project that use CMake. It's actually a great improvement from autoconf taht I'm currently using for my own projects. But I found no way to compile a large project for profiling.

 

With the following definitions in the topmost CMakeList.txt, it worked.

SET(CMAKE_BUILD_TYPE Profile)
SET(CMAKE_CXX_FLAGS_PROFILE "-g -pg -O0 -Werror")
SET(CMAKE_C_FLAGS_PROFILE "-g -pg -O0 -Werror")
SET(CMAKE_LINK_FLAGS_PROFILE "-pg")

Thanks to Filipe!