I was trying to answer a question on StackOverflow about how to effectively accomplish PGO using Clang. The manual workflow is typically to compile once with -fprofile-generate
and then again with -fprofile-use
after running a representative sample of your application’s functionality.
I thought it would be useful to drive this using a CMake preset workflow:
- Configure the project with
-fprofile-generate
- Build the project
- Run the tests marked with the
performance
label - Configure the project again with
-fprofile-use
- Build the project again
But CMake rejects this saying that only one configure step is allowed. Why is that? It seems like it would be useful to support doing something like what I outline above.
Here’s a link to my SO answer in case you want to repro this quickly: c++ - How can I express PGO dependencies in CMake 3.7 and higher? - Stack Overflow