Skip to content

Commit

Permalink
CMake: CCache: Always make clang happy
Browse files Browse the repository at this point in the history
When we are using ccache anyway, always add the flags to make clang
happy. Also, fix copy-paste error regarding what variable to modify for
it.
  • Loading branch information
Neui committed Jun 10, 2024
1 parent f91413d commit a1c5406
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions CMake/CCache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ if(CCACHE_BIN)
# Official ccache recommendation is to set CMAKE_C(XX)_COMPILER_LAUNCHER
if (NOT CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache")
list(INSERT CMAKE_C_COMPILER_LAUNCHER 0 "${CCACHE_BIN}")
# ccache uses -I when compiling without preprocessor, which makes clang complain.
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics")
endif()
endif()

if (NOT CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache")
list(INSERT CMAKE_CXX_COMPILER_LAUNCHER 0 "${CCACHE_BIN}")
# ccache uses -I when compiling without preprocessor, which makes clang complain.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics")
endif()
endif()

# ccache uses -I when compiling without preprocessor, which makes clang complain.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics")
endif()
endif()

0 comments on commit a1c5406

Please sign in to comment.