[PATCH] D28046: Add -Wl, -color-diagnostics if a linker supports the option.

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 13:21:29 PST 2017


inglorion added inline comments.


================
Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:592
+if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wl,-color-diagnostics")
----------------
ruiu wrote:
> inglorion wrote:
> > Why not check_cxx_compiler_flag("-Wl,-color-diagnostics" LINKER_SUPPORTS_COLOR_DIAGNOSTICS), analogous with check_c_compiler_flag below for -fno-function-sections? Would that allow us to avoid the dance with saving CMAKE_REQUIRED_FLAGS and restoring it to its old value?
> check_c_compiler_flags doesn't seem to link the result. It just compiles. So it cannot be used for testing -Wl,-something flags.
To clarify, I meant using check_cxx_compiler_flag (as you're doing), but passing the flag as the first argument, rather than by setting it in CMAKE_REQUIRED_FLAGS. Are you saying that passing the flag into check_cxx_compiler_flag() does not result in linking, but setting it in CMAKE_REQUIRED_FLAGS and passing an empty string to check_cxx_compiler_flag() does?


https://reviews.llvm.org/D28046





More information about the llvm-commits mailing list