CMake: compile a program twice in a row

Viewed 645

To be able to do many automatic optimizations, I want to be able to compile my program using the flag -fprofile-generate first, then run it to generate the profile and then re-compile the program with -fprofile-use instead.

This means I want to compile my program twice in a row, with two different CMAKE_CXX_FLAGS each time.

How can I do that using CMake?

1 Answers
Related