diff --git a/CMakeLists.txt b/CMakeLists.txt index 624fe0ad23..5a166a8a9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,15 @@ set_cxx17_superbuild() # this is an optional tool that stores compiled object files; allows fast # re-builds even with "make clean" in between. Mainly used to store AMReX # objects -set_ccache() +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + set(HiPACE_CCACHE_DEFAULT ON) +else() + set(HiPACE_CCACHE_DEFAULT OFF) # we are a subproject in a superbuild +endif() +option(HiPACE_CCACHE "Enable ccache for faster rebuilds" ${HiPACE_CCACHE_DEFAULT}) +if(HiPACE_CCACHE) + set_ccache() +endif() # Output Directories ##########################################################