Skip to content

Commit d078534

Browse files
authored
CDRIVER-4468 revert additional ccache checks (#1100)
* Revert "Do not elide find_package() if MONGO_USE_CCACHE is set (#1031)" This reverts commit 237bcf8. * Revert "Disable ccache by default for versions older than 3.4.3 (#1029)" This reverts commit f55cc6a.
1 parent 623d659 commit d078534

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

build/cmake/CCache.cmake

+5-32
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,15 @@
88
ON or OFF.
99
]]
1010

11+
# Find and enable ccache for compiling
1112
find_program (CCACHE_EXECUTABLE ccache)
12-
13-
# Enable ccache for compiling if not already configured.
14-
if (CCACHE_EXECUTABLE AND NOT DEFINED MONGO_USE_CCACHE)
13+
if (CCACHE_EXECUTABLE)
1514
message (STATUS "Found ccache: ${CCACHE_EXECUTABLE}")
16-
17-
execute_process (
18-
COMMAND ${CCACHE_EXECUTABLE} --version | perl -ne "print $1 if /^ccache version (.+)$/"
19-
OUTPUT_VARIABLE CCACHE_VERSION
20-
OUTPUT_STRIP_TRAILING_WHITESPACE
21-
)
22-
23-
# Assume `ccache --version` mentions a simple version string, e.g. "1.2.3".
24-
# Permit patch number to be omitted, e.g. "1.2".
25-
set (SIMPLE_SEMVER_REGEX "([0-9]+)\.([0-9]+)(\.([0-9]+))?")
26-
string (REGEX MATCH "${SIMPLE_SEMVER_REGEX}" CCACHE_VERSION ${CCACHE_VERSION})
27-
28-
if (CCACHE_VERSION)
29-
message (STATUS "Detected ccache version: ${CCACHE_VERSION}")
30-
else ()
31-
message (WARNING "Could not obtain ccache version from `ccache --version`. Defaulting to 0.1.0.")
32-
set (CCACHE_VERSION 0.1.0)
33-
endif ()
34-
35-
# Avoid spurious "ccache.conf: No such file or directory" errors due to ccache being invoked in parallel, which was patched in ccache version 3.4.3.
36-
if (CCACHE_VERSION VERSION_LESS "3.4.3")
37-
message (STATUS "Detected ccache version ${CCACHE_VERSION} is less than 3.4.3, which may lead to spurious failures when run in parallel. See https://github.com/ccache/ccache/issues/260 for more information.")
38-
message (STATUS "Compiling with CCache disabled. Enable by setting MONGO_USE_CCACHE to ON")
39-
option (MONGO_USE_CCACHE "Use CCache when compiling" OFF)
40-
else ()
41-
message (STATUS "Compiling with CCache enabled. Disable by setting MONGO_USE_CCACHE to OFF")
42-
option (MONGO_USE_CCACHE "Use CCache when compiling" ON)
43-
endif ()
44-
endif (CCACHE_EXECUTABLE AND NOT DEFINED MONGO_USE_CCACHE)
15+
option (MONGO_USE_CCACHE "Use CCache when compiling" ON)
16+
endif ()
4517

4618
if (MONGO_USE_CCACHE)
19+
message (STATUS "Compiling with CCache enabled. Disable by setting MONGO_USE_CCACHE to OFF")
4720
set (CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}")
4821
set (CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}")
4922
endif ()

0 commit comments

Comments
 (0)