mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
Merge pull request #9487 from ceph/wip_control_compiler_diagnostic_colors
Allows developers to turn on diagnostic colors for compiler output when stderr is not a terminal Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
commit
d361022036
@ -49,10 +49,25 @@ external dependencies:
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/accelio -DCMAKE_C_FLAGS="-O0 -g3 -gdwarf-4" \
|
||||
..
|
||||
|
||||
More options will be implemented in the future.
|
||||
If you often pipe `make`to `less` and would like to maintain the
|
||||
diagnostic colors for errors and warnings (and if your compiler
|
||||
supports it), you can invoke `cmake` with:
|
||||
|
||||
$ cmake -DDIAGNOSTICS_COLOR=always [...]
|
||||
|
||||
Then you'll get the diagnostic colors when you execute:
|
||||
|
||||
$ make | less -R
|
||||
|
||||
Other available values for DIAGNOSTICS_COLOR are 'auto' (default) and
|
||||
'never'.
|
||||
|
||||
|
||||
**More options will be implemented in the future.**
|
||||
|
||||
|
||||
Targets Built
|
||||
==============
|
||||
=============
|
||||
|
||||
* ceph-mon
|
||||
* ceph-osd
|
||||
|
@ -90,6 +90,21 @@ else()
|
||||
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
|
||||
endif()
|
||||
|
||||
|
||||
## Handle diagnostics color if compiler supports them.
|
||||
|
||||
CHECK_C_COMPILER_FLAG("-fdiagnostics-color=always"
|
||||
COMPILER_SUPPORTS_DIAGNOSTICS_COLOR)
|
||||
|
||||
set(DIAGNOSTICS_COLOR "auto"
|
||||
CACHE STRING "Used if the C/C++ compiler supports the -fdiagnostics-color option. May have one of three values -- 'auto' (default), 'always', or 'never'. If set to 'always' and the compiler supports the option, 'make [...] | less -R' will make visible diagnostics colorization of compiler output.")
|
||||
|
||||
if(COMPILER_SUPPORTS_DIAGNOSTICS_COLOR)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=${DIAGNOSTICS_COLOR}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=${DIAGNOSTICS_COLOR}")
|
||||
endif()
|
||||
|
||||
|
||||
## detect sse support
|
||||
|
||||
# create a tmp file with an empty main()
|
||||
|
Loading…
Reference in New Issue
Block a user