diff --git a/CMakeLists.txt b/CMakeLists.txt index 63eba1e3..d7515c59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,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(pyAMReX_CCACHE_DEFAULT ON) +else() + set(pyAMReX_CCACHE_DEFAULT OFF) # we are a subproject in a superbuild +endif() +option(pyAMReX_CCACHE "Enable ccache for faster rebuilds" ${pyAMReX_CCACHE_DEFAULT}) +if(pyAMReX_CCACHE) + set_ccache() +endif() # Output (build) Directories ################################################## diff --git a/docs/source/install/cmake.rst b/docs/source/install/cmake.rst index 8116220b..d70639f7 100644 --- a/docs/source/install/cmake.rst +++ b/docs/source/install/cmake.rst @@ -108,7 +108,7 @@ By default, the most important dependencies of pyAMReX are automatically downloa CMake Option Default & Values Description ============================= ============================================== =========================================================== ``BUILD_SHARED_LIBS`` ON/**OFF** Build shared libraries for dependencies -``CCACHE_PROGRAM`` First found ``ccache`` executable. Set to ``-DCCACHE_PROGRAM=NO`` to disable CCache. +``pyAMReX_CCACHE`` **ON**/OFF Search and use CCache to speed up rebuilds. ``pyAMReX_amrex_src`` *None* Path to AMReX source directory (preferred if set) ``pyAMReX_amrex_repo`` ``https://github.com/AMReX-Codes/amrex.git`` Repository URI to pull and build AMReX from ``pyAMReX_amrex_branch`` *we set and maintain a compatible commit* Repository branch for ``pyAMReX_amrex_repo``