]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add documentation to README.cmake.md. Have cmake produce messages
authorJ. Eric Ivancich <ivancich@redhat.com>
Fri, 3 Jun 2016 16:39:01 +0000 (12:39 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Tue, 7 Jun 2016 16:21:49 +0000 (12:21 -0400)
(status or warning) when diagnostics color is requested via
-DDIAG_COLOR_ALWAYS=yes.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
README.cmake.md
src/CMakeLists.txt

index acdc66dd4805f27f2fabadf0d07b1ae90181bdfc..0ecba08a384bcf990fa0648a686973f2a8bd411a 100644 (file)
@@ -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 
index 9fcebb915c3477e2e95ddc8b78856aa7ba429a68..fa21662c7d5eba20ba3041ad17972cda1d20f4f0 100644 (file)
@@ -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()