Skip to content

build: fix MSVC ccache reporting

Fixes #31771

Summary

This PR resolves the incorrect reporting of ccache usage for MSVC builds by:

  1. Removing forced compiler launcher configuration
  2. Improving status message accuracy
  3. Documenting proper MSVC+ccache workflows

Key Changes

  • Deleted: cmake/ccache.cmake (Eliminates conflicts with user/CI configurations like sccache)
  • Updated: CMakeLists.txt status reporting
    if(CMAKE_CXX_COMPILER_LAUNCHER)
      message(STATUS "Compiler launcher .............. ${CMAKE_CXX_COMPILER_LAUNCHER}")
    else()
      message(STATUS "Use ccache for compiling .............. NO")
    endif()
  • Added Documentation:
    • Requires: Ninja generator
    • Configure: cmake -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
    • Use: /Z7 debug flags (not /Zi)

Testing

# MSVC 2022 + Ninja
cmake -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build
ccache -s  # Verified cache hits

# User override test
cmake -B build -DCMAKE_CXX_COMPILER_LAUNCHER=sccache  # No conflicts

Merge request reports

Loading