Skip to content

Commit

Permalink
Merge #325: cmake: Improve summary output about ccache
Browse files Browse the repository at this point in the history
af1ab38 fixup! cmake: Add `ccache` support (Hennadii Stepanov)
855f7e4 fixup! cmake: Add `ccache` support (Hennadii Stepanov)

Pull request description:

  1. From bitcoin#30454 (comment):
  > I think we can improve the output when `-DWITH_CCACHE=OFF` is used. Depending on the system, that output might be:
  >
  > ```
  > cmake -B build -DWITH_CCACHE=OFF
  > < snip >
  > Use ccache for compiling .............. ccache masquerades as the compiler
  > ```
  >
  > We should probably at least indicate that the option was respected by the build-system.

  With this PR on Fedora 40:
  ```
  $ cmake -B build -DWITH_CCACHE=OFF
  < snip >
  Use ccache for compiling .............. ON

    ******

  CMake Warning at CMakeLists.txt:656 (message):
    Disabling ccache was attempted using -DWITH_CCACHE=OFF, but ccache
    masquerades as the compiler.

    ******
  ```

  2. The second commit fixes a bug introduced in #298.

Top commit has no ACKs.

Tree-SHA512: cd5e9b1a6618e147cd1ac9d1b592b7c5e3dd650caa53cd80c0db7a00d2bfd510882c39ac88ee028494faa09bc03cdfba9024124c619dc12d0289a085d32876d9
  • Loading branch information
hebasto committed Aug 15, 2024
2 parents ed373e3 + af1ab38 commit a681714
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmake/ccache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,25 @@ if(NOT MSVC)
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(CCACHE_EXECUTABLE STREQUAL compiler_resolved_link)
set(WITH_CCACHE "ccache masquerades as the compiler")
if(CCACHE_EXECUTABLE STREQUAL compiler_resolved_link AND NOT WITH_CCACHE)
list(APPEND configure_warnings
"Disabling ccache was attempted using -DWITH_CCACHE=${WITH_CCACHE}, but ccache masquerades as the compiler."
)
set(WITH_CCACHE ON)
elseif(WITH_CCACHE)
list(APPEND CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
list(APPEND CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
endif()
else()
set(WITH_CCACHE OFF)
endif()
if(WITH_CCACHE)
try_append_cxx_flags("-fdebug-prefix-map=A=B" TARGET core_interface SKIP_LINK
IF_CHECK_PASSED "-fdebug-prefix-map=${PROJECT_SOURCE_DIR}=."
)
try_append_cxx_flags("-fmacro-prefix-map=A=B" TARGET core_interface SKIP_LINK
IF_CHECK_PASSED "-fmacro-prefix-map=${PROJECT_SOURCE_DIR}=."
)
else()
set(WITH_CCACHE OFF)
endif()
endif()

Expand Down

0 comments on commit a681714

Please sign in to comment.