diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index eaf4cac0a..59b87a3b1 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -38,7 +38,9 @@ else: rmfile_prefix = 'rm -f {} &&' def ninja_quote(text): - return text.replace(' ', '$ ').replace(':', '$:') + for char in ('$', ' ', ':', '\n'): + text = text.replace(char, '$' + char) + return text class NinjaBuildElement: