mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Use CMAKE_COLOR_DIAGNOSTICS (#154583)
`CMAKE_COLOR_DIAGNOSTICS` was introduced in CMake 2.24. Use it to simplify CMake code. Pull Request resolved: https://github.com/pytorch/pytorch/pull/154583 Approved by: https://github.com/ezyang
This commit is contained in:
parent
d43c0bdf46
commit
95cb42c45d
|
|
@ -985,6 +985,9 @@ endif()
|
||||||
# ---[ Build flags Re-include to override append_cxx_flag_if_supported from
|
# ---[ Build flags Re-include to override append_cxx_flag_if_supported from
|
||||||
# third_party/FBGEMM
|
# third_party/FBGEMM
|
||||||
include(cmake/public/utils.cmake)
|
include(cmake/public/utils.cmake)
|
||||||
|
if(USE_COLORIZE_OUTPUT)
|
||||||
|
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
||||||
|
endif()
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
string(APPEND CMAKE_CXX_FLAGS " -O2 -fPIC")
|
string(APPEND CMAKE_CXX_FLAGS " -O2 -fPIC")
|
||||||
|
|
||||||
|
|
@ -1060,19 +1063,6 @@ if(NOT MSVC)
|
||||||
CMAKE_CXX_FLAGS)
|
CMAKE_CXX_FLAGS)
|
||||||
append_cxx_flag_if_supported("-Qunused-arguments" CMAKE_CXX_FLAGS)
|
append_cxx_flag_if_supported("-Qunused-arguments" CMAKE_CXX_FLAGS)
|
||||||
|
|
||||||
if(${USE_COLORIZE_OUTPUT})
|
|
||||||
# Why compiler checks are necessary even when `try_compile` is used Because
|
|
||||||
# of the bug in ccache that can incorrectly identify `-fcolor-diagnostics`
|
|
||||||
# As supported by GCC, see https://github.com/ccache/ccache/issues/740 (for
|
|
||||||
# older ccache) and https://github.com/ccache/ccache/issues/1275 (for newer
|
|
||||||
# ones)
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
||||||
append_cxx_flag_if_supported("-fdiagnostics-color=always" CMAKE_CXX_FLAGS)
|
|
||||||
else()
|
|
||||||
append_cxx_flag_if_supported("-fcolor-diagnostics" CMAKE_CXX_FLAGS)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
append_cxx_flag_if_supported("-faligned-new" CMAKE_CXX_FLAGS)
|
append_cxx_flag_if_supported("-faligned-new" CMAKE_CXX_FLAGS)
|
||||||
|
|
||||||
if(WERROR)
|
if(WERROR)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user