QtCreator + CMake: Several targets from the same code with #ifdef's
I am using the same sources to generate two binaries that are mostly the same except for some code in #ifdefs. I know this is a bad practice (common in the scientific/Fortran world), but sometimes is useful and simple for optimization.
When I generate my project in CMake, QtCreator recognises each of the targets and I can select which executable I want to compile/run/debug without problems. However, the syntax evaluator does not take this into account and I don't see the #ifdef'd parts of the code change from inactive to active when I do so, and code completion does not work properly in those regions.
I believe with previous versions of QtCreator (I am using 4.1) this would work, but I am not too sure. Is this supported at all? If so, which is the way to make it work?