diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-01-28 00:42:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-28 00:42:13 +0100 |
commit | 881d4adb5942301a26ccd45315e146eccb114519 (patch) | |
tree | c9326939507b7de0b8a910bc8c1b928d6e492a49 /src | |
parent | 2cde6a18b5dea27fdff673baa876c505696d297f (diff) | |
download | rneovim-881d4adb5942301a26ccd45315e146eccb114519.tar.gz rneovim-881d4adb5942301a26ccd45315e146eccb114519.tar.bz2 rneovim-881d4adb5942301a26ccd45315e146eccb114519.zip |
build: enable ccache by default if available (#22020)
Initial benchmarks show that this gives a nice 50% compile time
reduction for neovim. This shouldn't affect users or CI, but it's a nice
speedup for local development. The C_COMPILER_LAUNCHER target property
is only supported by Makefiles and Ninja generators only, so this won't
give a speedup when using the Xcode and Visual Studio generators even if
ccache is available.
Diffstat (limited to 'src')
-rwxr-xr-x | src/nvim/CMakeLists.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 77ed0490d8..d1bf08f3fb 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -688,6 +688,13 @@ set_target_properties(nvim EXPORT_COMPILE_COMMANDS ON ENABLE_EXPORTS TRUE) +find_program(CCACHE_PRG ccache) +if(CCACHE_PRG) + set_target_properties(nvim + PROPERTIES + C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;CCACHE_SLOPPINESS=pch_defines,time_macros;${CCACHE_PRG}") +endif() + if(${CMAKE_VERSION} VERSION_LESS 3.20) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) endif() |