From 0895999e36bc2ffdb1db78165793c8f9c57ff166 Mon Sep 17 00:00:00 2001 From: "a.yankovich" Date: Thu, 29 Aug 2019 18:04:56 +0300 Subject: [PATCH] added ccache for cmake (not work) --- .gitignore | 15 +++++++++++++++ cmake/QuasarApp.cmake | 2 +- cmake/QuasarAppOut.cmake | 2 +- cmake/ccache.cmake | 28 ++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 cmake/ccache.cmake diff --git a/.gitignore b/.gitignore index 903365d..8cb622d 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,18 @@ CMakeLists.txt.user* build/* *.user* + +#cmake + +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps +*_autogen diff --git a/cmake/QuasarApp.cmake b/cmake/QuasarApp.cmake index 8bd9a1c..8b2d142 100644 --- a/cmake/QuasarApp.cmake +++ b/cmake/QuasarApp.cmake @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.1) IF(NOT QUASARAPP_LIB) SET(QUASARAPP_LIB True) - include(QuasarAppOut.cmake) + include(QuasarAppOut.cmake) target_link_libraries(${PROJECT_NAME} ${QUASARAPP_LIB_NAME}) target_include_directories(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/cmake/QuasarAppOut.cmake b/cmake/QuasarAppOut.cmake index bbca7b7..709ee64 100644 --- a/cmake/QuasarAppOut.cmake +++ b/cmake/QuasarAppOut.cmake @@ -19,4 +19,4 @@ ENDIF(CMAKE_BUILD_TYPE EQUAL Release) message(QUASARAPP_LIB_OUTPUT_DIR = ${QUASARAPP_LIB_OUTPUT_DIR}) - +include(cmake/ccache.cmake) diff --git a/cmake/ccache.cmake b/cmake/ccache.cmake new file mode 100644 index 0000000..a5954f2 --- /dev/null +++ b/cmake/ccache.cmake @@ -0,0 +1,28 @@ +# +# Copyright (C) 2018-2019 QuasarApp. +# Distributed under the lgplv3 software license, see the accompanying +# Everyone is permitted to copy and distribute verbatim copies +# of this license document, but changing it is not allowed. +# + +IF(NOT CCACHE_INCLUDE) + SET(CCACHE_INCLUDE True) + IF(CMAKE_HOST_SYSTEM_NAME EQUAL Linux) + + execute_process(COMMAND "which" "ccache" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + RESULT_VARIABLE which_result + OUTPUT_VARIABLE BIN) + + IF (${BIN} STREQUAL "") + message("ccache disabled for ${PROJECT_NAME}") + ELSE() + SET(CMAKE_CXX_COMPILER "${BIN} ${CMAKE_CXX_COMPILER}") + message("ccache enabled for ${CMAKE_CXX_COMPILER}") + + ENDIF (${BIN} STREQUAL "") + + ENDIF(CMAKE_HOST_SYSTEM_NAME EQUAL Linux) + +ENDIF(NOT CCACHE_INCLUDE) +