diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index e76454584b..483a6015d0 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -35,7 +35,11 @@ namespace { bool cmExecuteProcessCommandIsWhitespace(char c) { - return (isspace(static_cast(c)) || c == '\n' || c == '\r'); + // isspace takes 'int' but documents that the value must be representable + // by 'unsigned char', or EOF. Cast to 'unsigned char' to avoid sign + // extension while casting to 'int'. + return (isspace(static_cast(static_cast(c))) || + c == '\n' || c == '\r'); } void cmExecuteProcessCommandFixText(std::vector& output,