diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-06-08 04:02:13 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-06-08 15:05:11 (GMT) |
commit | 8195aa30269773732902029741fb8adfe13aa83d (patch) | |
tree | 33f795e6dcdcf548c989d15eab8d11f81aa5026a /Source/cmMakefileTargetGenerator.cxx | |
parent | c01091d2cf786f361a47a2875ba73d05c1642488 (diff) | |
download | CMake-8195aa30269773732902029741fb8adfe13aa83d.zip CMake-8195aa30269773732902029741fb8adfe13aa83d.tar.gz CMake-8195aa30269773732902029741fb8adfe13aa83d.tar.bz2 |
Makefiles: quote `$(COLOR)` expansions
This handles the case where `COLOR` is set to some ANSI-like color
sequence in the ambient environment. These sequences tend to include `;`
which terminates the command and tries to use the next component
(typically an integer, possibly with a trailing `m`) with errors like:
/bin/sh: line 1: 2: command not found
/bin/sh: line 1: 255: command not found
/bin/sh: line 1: 221: command not found
/bin/sh: line 1: 255m: command not found
Also add a test that sets `COLOR` in the environment which affects the
generated Makefiles behavior.
See: https://discourse.cmake.org/t/cmake-failing-gcc-compiler-checks/8277
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 8099d44..5f27856 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1525,7 +1525,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() cmSystemTools::CollapseFullPath(this->InfoFileNameFull), cmOutputConverter::SHELL); if (this->LocalGenerator->GetColorMakefile()) { - depCmd << " --color=$(COLOR)"; + depCmd << " \"--color=$(COLOR)\""; } commands.push_back(depCmd.str()); |