configure_file(): cmakedefine default value

Good day!

Could you help me please? Is there any way to use ‘default’ values in .in files or some other logic?

For example
#cmakedefine TIME_FORMAT @TIME_FORMAT@ “%b %e %T”

So if TIME_FORMAT is set - it uses its value for #define, otherwise it uses “%b %e %T”

PS: I know, i can check it in CMakeLists.txt and set this default value in it. But looking for a solution, where this login will be inside .in file

Thanks!

No, there’s no functionality for this. I don’t think it should be done anyways because then there’s yet another “language” for logic available through CMake code. Just put the logic in the CMake code around the configure_file and it can be as complex as you want.

Thank you for a quick reply.