Thank you for the replies... So I think for profiling I will - 1) reorganise my CMakeLists.txt around so the flags are set in one place only - 2) Add a variable to say wether or not to do some profiling, regardless of the build type . I guess I could want to do some profiling in debug and in release mode as well, although I am not sure right now if this will be usefull anyway... when I get that working I can always revert to a specific profiling build type. - 3) changed the flags when I want some profiling, using only gprof and only platform using gcc...
I am referring to : http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC2 I think CMake is using g++ to make the linkage isnt it ? Therefore passing only the option -pg should be enough I guess... However I end up with programs where all command line arguments are completely wrong... What did I miss? do I really need to link against /lib/gcrt0.o like explicited for ld in the webpage for gprof ?? Does someone knows where I can find an example cmakelists.txt using gprof ? ;) Is it a problem in my cmakelists or should I better ask some gprof guys ? ;) Using CMake 2.4.2 on NetBSD 4.0, my command line looks like : /usr/bin/c++ -pg -Wall -Wabi -g -D_DEBUG -I/home/user/includes -DMYCPPDEF -o CMakeFiles/Project.dir/Project.o -c /home/alex/DEV/AML/SDLut/Project.cc /usr/bin/c++ -pg -Wall -Wabi -g -D_DEBUG -fPIC -pg -Wl,--warn-unresolved-symbols,--warn-once "CMakeFiles/Project.dir/Project.o" -o ../bin/Project -L/path_to_libs -lusedlibs -lpthread -Wl,-rpath,/path_to_libs Thanks again for the help ! -- Asmodehn On Tue, 13 Mar 2007 22:17:31 +0000 Filipe Sousa <[EMAIL PROTECTED]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Brandon J. Van Every wrote: > > Asmodehn Shade wrote: > >> Hi everyone, > >> > >> I am currently in the process of starting to profile my software. > >> It builds with cmake on unix, linux, and windows, more or less nicely ;) > >> Assuming that I only want to use g++ with gprof right now, I wonder if > >> there was a way to do that smartly in CMake, > >> other than resetting the CXX_FLAGS and LINKER_FLAGS around all my > >> CMakeLists.txt... > >> > > > > You need to clean up your CMAKE_CXX_FLAGS and so forth so they are set > > in 1 user controllable place. > > It's possible to create a new set of flags through CMAKE_BUILD_YTPE > > SET(CMAKE_BUILD_TYPE Profile) > SET(CMAKE_CXX_FLAGS_PROFILE ...) > SET(CMAKE_C_FLAGS_PROFILE ...) > > >> Is there already some functions handling that in CMake ? > >> > > > > Not for profiling. Not for optimization either, other than "Release" > > giving you sane defaults. Nothing for CPU architecture specification > > either. > > > > > >> - should I handle every profiler on different platform myself with some > >> custom FindProfiler UseProfiler and so on ? > >> > > > > Do you actually need to profile on all platforms, or is this > > theoretical? If it's theoretical, I'd say skip the busywork. > > > > > > Cheers, > > Brandon Van Every > > > > _______________________________________________ > > CMake mailing list > > [email protected] > > http://www.cmake.org/mailman/listinfo/cmake > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFF9yL7bQdNYqwwwCwRAk1pAJ9L3EKbBVPHN7wvxQZCzB/IwU//0ACglwUC > 72EGxmUCXUwVb4DQ7mILNhc= > =ZO9O > -----END PGP SIGNATURE----- > _______________________________________________ > CMake mailing list > [email protected] > http://www.cmake.org/mailman/listinfo/cmake _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
