mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Add -Wl,-color-diagnostics if a linker supports the option.
Differential Revision: https://reviews.llvm.org/D28046 llvm-svn: 291719
This commit is contained in:
parent
8582abf465
commit
43a59ed7bc
8
cmake/modules/CheckLinkerFlag.cmake
Normal file
8
cmake/modules/CheckLinkerFlag.cmake
Normal file
@ -0,0 +1,8 @@
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
function(check_linker_flag flag out_var)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
|
||||
check_cxx_compiler_flag("" ${out_var})
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
endfunction()
|
@ -597,6 +597,14 @@ if (UNIX AND
|
||||
append("-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
|
||||
# lld doesn't print colored diagnostics when invoked from Ninja
|
||||
if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
include(CheckLinkerFlag)
|
||||
check_linker_flag("-Wl,-color-diagnostics" LINKER_SUPPORTS_COLOR_DIAGNOSTICS)
|
||||
append_if(LINKER_SUPPORTS_COLOR_DIAGNOSTICS "-Wl,-color-diagnostics"
|
||||
CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
|
||||
endif()
|
||||
|
||||
# Add flags for add_dead_strip().
|
||||
# FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
|
||||
# But MinSizeRel seems to add that automatically, so maybe disable these
|
||||
|
Loading…
x
Reference in New Issue
Block a user