aboutsummaryrefslogtreecommitdiff
path: root/cmake/FindCcache.cmake
diff options
context:
space:
mode:
authormj-xmr <mjxmr@protonmail.com>2020-05-04 09:46:31 +0200
committermj-xmr <mjxmr@protonmail.com>2020-05-04 09:46:31 +0200
commit3843a6aba5a386554da5f301862270f8decc39dc (patch)
treeeac9aea233f8e88e2d8863f0a8595607121f413b /cmake/FindCcache.cmake
parentMerge pull request #6451 (diff)
downloadmonero-3843a6aba5a386554da5f301862270f8decc39dc.tar.xz
Made ccache optional (opt out) and tidied up the FindCcache.cmake
Diffstat (limited to 'cmake/FindCcache.cmake')
-rw-r--r--cmake/FindCcache.cmake15
1 files changed, 9 insertions, 6 deletions
diff --git a/cmake/FindCcache.cmake b/cmake/FindCcache.cmake
index fa357610b..a0734a312 100644
--- a/cmake/FindCcache.cmake
+++ b/cmake/FindCcache.cmake
@@ -41,17 +41,20 @@
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
- set(TEMP_CPP_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test-program.cpp")
+ # Try to compile a test program with ccache, in order to verify if it really works. (needed on exotic setups)
+ # Create a temporary file with a simple program.
+ set(TEMP_CPP_FILE "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/test-program.cpp")
file(WRITE "${TEMP_CPP_FILE}" "int main() { return 0; }")
+ # And run the found ccache on it.
execute_process(COMMAND "${CCACHE_FOUND}" "${CMAKE_CXX_COMPILER}" "${TEMP_CPP_FILE}" RESULT_VARIABLE RET)
if (${RET} EQUAL 0)
- message("found usable ccache: ${CCACHE_FOUND}")
+ # Success
+ message(STATUS "Found usable ccache: ${CCACHE_FOUND}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_FOUND}")
else()
- message("found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}")
- endif()
+ message(STATUS "Found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}")
+ endif()
else()
- message("ccache NOT found!")
+ message(STATUS "ccache NOT found! Please install it for faster rebuilds.")
endif()
-