I would like to create a parallel build of my project along with the serial executable. The sources (both added libraries and main.cpp) use a define to enable MPI. When the serial version is compiled, the define is not present however I need to recompile everything with the define to create the parallel executable.
Is it possible to get CMake to compile the serial executable, then recompile everything with an additional add_compile_definitions (as well as linking MPI_C) so that the MPI code is enabled and a parallel executable is created?