The added format argument for configure_file allows to specify the kind of file that is treated. It defaults to 'meson', but can also have the 'cmake' or 'cmake@' value to treat config.h.in files in the cmake format with #cmakedefine statements.pull/2332/merge
parent
aed11affd3
commit
6dea177774
6 changed files with 78 additions and 10 deletions
@ -0,0 +1,16 @@ |
||||
/* No escape */ |
||||
#define MESSAGE1 "${var1}" |
||||
|
||||
/* Single escape means no replace */ |
||||
#define MESSAGE2 "\${var1}" |
||||
|
||||
/* Replace pairs of escapes before '@' or '\@' with escape characters
|
||||
* (note we have to double number of pairs due to C string escaping) |
||||
*/ |
||||
#define MESSAGE3 "\\\\${var1}" |
||||
|
||||
/* Pairs of escapes and then single escape to avoid replace */ |
||||
#define MESSAGE4 "\\\\\${var1}" |
||||
|
||||
/* Check escape character outside variables */ |
||||
#define MESSAGE5 "\\ ${ \${ \\\\${ \\\\\${" |
@ -0,0 +1,10 @@ |
||||
#include <string.h> |
||||
#include <config7.h> |
||||
|
||||
int main(int argc, char **argv) { |
||||
return strcmp(MESSAGE1, "foo") |
||||
|| strcmp(MESSAGE2, "${var1}") |
||||
|| strcmp(MESSAGE3, "\\foo") |
||||
|| strcmp(MESSAGE4, "\\${var1}") |
||||
|| strcmp(MESSAGE5, "\\ ${ ${ \\${ \\${"); |
||||
} |
Loading…
Reference in new issue