It always looks in main.c like F2 is defined, also if I select prop1 in "Select Run/Debug Configuration". But in f.c it always looks the other way around.
main.c:
#if defined(F1) #include "f1.h" // this is gray #elif defined(F2) #include "f2.h" // this is strong #endif
Build works in both command line and CLion sample in attachment
This is what I mean:
#define FOO
#if defined(FOO)
/* this will be reformated after "reformat code" - command*/
#elif defind(BAR)
/* this not */
#endif
Hi Andreas.
https://youtrack.jetbrains.com/issue/CPP-2286
But the request can’t be solved in near future, because its currently impossible parse all possibilities of conditional compilation directives.
Hi Anna,
is it possible to give compile-time defines to the clion gui?
I have different targets which share soure code. But they use different header files.
add_executable(prop1 main.c f.c)
SET_TARGET_PROPERTIES(prop1 PROPERTIES COMPILE_DEFINITIONS "F1")
add_executable(prop2 main.c f.c)
SET_TARGET_PROPERTIES(prop2 PROPERTIES COMPILE_DEFINITIONS "F2")
It always looks in main.c like F2 is defined, also if I select prop1 in "Select Run/Debug Configuration". But in f.c it always looks the other way around.
main.c:
#include "f1.h" // this is gray
#elif defined(F2)
#include "f2.h" // this is strong
#endif
Build works in both command line and CLion
sample in attachment
best regards Andreas
Attachment(s):
prop.zip