From f8f343fd3ae5bff315224b30d8a8ac9293da6b14 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 29 Nov 2017 14:01:37 -0600 Subject: [PATCH] Add --ccache option to configure script (requires CMake 3.10+). This just provides a convient way of indicating that ccache should be used as compiler-wrapper during builds. e.g. when I want dev/debug builds that (re)compile quickly, I do: ./configure --build-type=debug --generator=Ninja --ccache --- CHANGES | 4 ++++ CMakeLists.txt | 12 ++++++++++++ VERSION | 2 +- configure | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c664bca820..f8c54b1b19 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +2.5-359 | 2017-11-29 14:01:37 -0600 + + * Add --ccache option to configure script (requires CMake 3.10+). (Corelight) + 2.5-358 | 2017-11-28 12:28:14 -0800 * Extend the TLS analyzer with several events containing cryptographic diff --git a/CMakeLists.txt b/CMakeLists.txt index 31e2346dfe..2abd715732 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,18 @@ include(cmake/CommonCMakeConfig.cmake) ######################################################################## ## Project/Build Configuration +if ( ENABLE_CCACHE ) + find_program(CCACHE_PROGRAM ccache) + + if ( NOT CCACHE_PROGRAM ) + message(FATAL_ERROR "ccache not found") + endif () + + message(STATUS "Using ccache: ${CCACHE_PROGRAM}") + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) +endif () + set(BRO_ROOT_DIR ${CMAKE_INSTALL_PREFIX}) if (NOT BRO_SCRIPT_INSTALL_PATH) # set the default Bro script installation path (user did not specify one) diff --git a/VERSION b/VERSION index d05adf51f7..253e551217 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.5-358 +2.5-359 diff --git a/configure b/configure index 757dfc595b..23b12bfb03 100755 --- a/configure +++ b/configure @@ -25,6 +25,8 @@ Usage: $0 [OPTION]... [VAR=VALUE]... - RelWithDebInfo: optimizations on, debug symbols on, debug flags off --generator=GENERATOR CMake generator to use (see cmake --help) + --ccache use ccache to speed up recompilation (requires + ccache installation and CMake 3.10+) Installation Directories: --prefix=PREFIX installation directory [/usr/local/bro] @@ -169,6 +171,9 @@ while [ $# -ne 0 ]; do --generator=*) CMakeGenerator="$optarg" ;; + --ccache) + append_cache_entry ENABLE_CCACHE BOOL true + ;; --prefix=*) prefix=$optarg append_cache_entry CMAKE_INSTALL_PREFIX PATH $optarg