From: J. Eric Ivancich Date: Fri, 3 Jun 2016 16:39:01 +0000 (-0400) Subject: Add documentation to README.cmake.md. Have cmake produce messages X-Git-Tag: v11.0.0~275^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=be585d271d1e434b7a9de8565304347f256bc368;p=ceph.git Add documentation to README.cmake.md. Have cmake produce messages (status or warning) when diagnostics color is requested via -DDIAG_COLOR_ALWAYS=yes. Signed-off-by: J. Eric Ivancich --- diff --git a/README.cmake.md b/README.cmake.md index acdc66dd480..0ecba08a384 100644 --- a/README.cmake.md +++ b/README.cmake.md @@ -49,10 +49,21 @@ 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, you can invoke `cmake` +with: + + $ cmake -DDIAG_COLOR_ALWAYS=yes [...] + +Then you'll get the diagnostic colors when you execute: + + $ make | less -R + +**More options will be implemented in the future.** + Targets Built -============== +============= * ceph-mon * ceph-osd diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fcebb915c3..fa21662c7d5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -98,9 +98,15 @@ endif() CHECK_C_COMPILER_FLAG("-fdiagnostics-color=always" COMPILER_SUPPORTS_DIAG_COLOR_ALWAYS) -if(COMPILER_SUPPORTS_DIAG_COLOR_ALWAYS AND DIAG_COLOR_ALWAYS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") +if(DIAG_COLOR_ALWAYS) + if(COMPILER_SUPPORTS_DIAG_COLOR_ALWAYS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") + message(STATUS "C and C++ compilers will always show diagnostic colors") + else() + message(WARNING + "Unable to turn on DIAG_COLOR_ALWAYS, because this compiler does not support -fdiagnostics-color=always flag.") + endif() endif()