-
-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake: Force GCC/Clang color diagnostics for Ninja (#1596) #1597
base: master
Are you sure you want to change the base?
Conversation
Linux users are recommended to use Ninja when generating the build files through CMake. Ninja buffers output, so tools are writing to a pipe, not directly to the terminal, so auto-detection may turn ANSI colored output off conservatively. This forces color diagnostics.
This resolves #1596. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of a new flag and trying to support older versions of Cmake, should we just change the default for CMAKE_COLOR_DIAGNOSTICS for relevant generators and CMake versions?
The |
I do agree that we can just always apply it for Ninja gen builds and remove the new CMake option, since it should not affect anything with the build unless someone doesn't want the compiler to print ANSI colors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with this, but can we make it a cache variable, so that users can disable it? And if people turn it off, we shouldn't add the compiler option.
Sorry for the late update, was busy for a few weeks. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am okay with this as well.
Issue description
Linux users are recommended to use Ninja when generating the build files through CMake. Ninja buffers output, so tools are writing to a pipe, not directly to the terminal, so auto-detection may turn ANSI colored output off conservatively.
Solution description
This PR forces color diagnostics by setting
CMAKE_COLOR_DIAGNOSTICS
toON
on CMake versions 3.24 and above. For older CMake versions, compiler flags are invoked manually for GCC and Clang.Checklist
I have done my best to ensure that…