Search code examples
cmakeprofiler

Has CMake a build type for Profile?


CMake has several build types like Release, Debug, Release with debug info and Minimum size release. I was wondering if another build types can be added like Profile by users and if it is a well-known practice done by other programmers.


Solution

  • You definitely can add your own build types. Here is the example of how to do it. Essentially, you just need to add all the variables like CMAKE_CXX_FLAGS_XXX with the suffix corresponding to your build type and of course update the CMAKE_BUILD_TYPE variable to account for the new type. Not sure how well-know this practice is(personally I never did it) but it certainly looks viable.