Skip to content

Commit

Permalink
cmake: Rename build option CCACHE to WITH_CCACHE
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed May 21, 2024
1 parent 63f15c4 commit 2a8aba3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ option(WERROR "Treat compiler warnings as errors." OFF)
# TODO: These tri-state options will be removed and most features
# will become opt-in by default before merging into master.
include(TristateOption)
tristate_option(CCACHE "Use ccache for compiling." "if ccache is found." AUTO)
tristate_option(WITH_CCACHE "Use ccache for compiling." "if ccache is found." AUTO)

option(WITH_NATPMP "Enable NAT-PMP." OFF)
if(WITH_NATPMP)
Expand Down Expand Up @@ -649,7 +649,7 @@ message("Linker flags for shared libraries ..... ${CMAKE_SHARED_LINKER_FLAGS} ${
print_config_flags()
message("Attempt to harden executables ......... ${HARDENING}")
message("Treat compiler warnings as errors ..... ${WERROR}")
message("Use ccache for compiling .............. ${CCACHE}")
message("Use ccache for compiling .............. ${WITH_CCACHE}")
message("\n")
if(configure_warnings)
message(" ******\n")
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"WITH_MINIUPNPC": "ON",
"WITH_ZMQ": "ON",
"WERROR": "ON",
"CCACHE": "ON"
"WITH_CCACHE": "ON"
}
},
{
Expand Down
16 changes: 8 additions & 8 deletions cmake/optional.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Optional features and packages.

if(CCACHE)
if(WITH_CCACHE)
set(ccache_hints)
if(MSVC AND EXISTS "$ENV{ChocolateyInstall}")
# Bypass a shim executable provided by Chocolatey.
Expand All @@ -19,7 +19,7 @@ if(CCACHE)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
# ccache >= 4.8 requires compile batching turned off that is available since CMake 3.24.
# See https://github.com/ccache/ccache/wiki/MS-Visual-Studio
set(CCACHE ON)
set(WITH_CCACHE ON)
file(COPY_FILE ${CCACHE_COMMAND} ${CMAKE_BINARY_DIR}/cl.exe ONLY_IF_DIFFERENT)
list(APPEND CMAKE_VS_GLOBALS
"CLToolExe=cl.exe"
Expand All @@ -30,20 +30,20 @@ if(CCACHE)
# By default Visual Studio generators will use /Zi which is not compatible
# with ccache, so tell Visual Studio to use /Z7 instead.
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")
elseif(CCACHE STREQUAL "AUTO")
elseif(WITH_CCACHE STREQUAL "AUTO")
message(WARNING "ccache requested and found, but CMake >= 3.24 is required to use it properly. Disabling.\n"
"To skip ccache check, use \"-DCCACHE=OFF\".\n")
set(CCACHE OFF)
"To skip ccache check, use \"-DWITH_CCACHE=OFF\".\n")
set(WITH_CCACHE OFF)
else()
message(FATAL_ERROR "ccache requested and found, but CMake >= 3.24 is required to use it properly.")
endif()
else()
set(CCACHE ON)
set(WITH_CCACHE ON)
list(APPEND CMAKE_C_COMPILER_LAUNCHER ${CCACHE_COMMAND})
list(APPEND CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_COMMAND})
endif()
elseif(CCACHE STREQUAL "AUTO")
set(CCACHE OFF)
elseif(WITH_CCACHE STREQUAL "AUTO")
set(WITH_CCACHE OFF)
else()
message(FATAL_ERROR "ccache requested, but not found.")
endif()
Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ mkdir -p "$DISTSRC"
env CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" LDFLAGS="${HOST_LDFLAGS}" \
cmake -S . -B build \
--toolchain "${BASEPREFIX}/${HOST}/toolchain.cmake" \
-DCCACHE=OFF \
-DWITH_CCACHE=OFF \
${CONFIGFLAGS}

# Build Bitcoin Core
Expand Down

0 comments on commit 2a8aba3

Please sign in to comment.