configure_file in built-in modules doesn't escape special characters
Many of the built-in modules save some variables via configure_file
. We ran into in this in BoringSSL by passing the path to yasm via CMAKE_ASM_NASM_COMPILER
, which seems to use CMakeASMCompiler.cmake.in
. On Windows, file paths are usually written with \ and things like Python's os.path
module will make paths this way.
I think the simplest option given this architecture would be to add a knob like ESCAPE_QUOTES
(or is it legal to just change ESCAPE_QUOTES
?) to escape not just ", but also \ and $. Maybe whitespace too, so .in files can use either "@_CMAKE_ASM_COMPILER@"
or @_CMAKE_ASM_COMPILER@
? The semantics would be that each substitution ends up as a single argument when parsed by CMake.
Then probably more-or-less every configure_file
invocation in built-in modules wants to have this new setting enabled. (Perhaps name it ESCAPE_STRINGS
or ESCAPE_CMAKE
?)