Skip to content

Commit 64e1c06

Browse files
authored
Add pyAMReX_CCACHE Option (#247)
Cleaner way to disable CCache in package managers.
1 parent e8a6c04 commit 64e1c06

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@ set_cxx17_superbuild()
4040
# this is an optional tool that stores compiled object files; allows fast
4141
# re-builds even with "make clean" in between. Mainly used to store AMReX
4242
# objects
43-
set_ccache()
43+
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
44+
set(pyAMReX_CCACHE_DEFAULT ON)
45+
else()
46+
set(pyAMReX_CCACHE_DEFAULT OFF) # we are a subproject in a superbuild
47+
endif()
48+
option(pyAMReX_CCACHE "Enable ccache for faster rebuilds" ${pyAMReX_CCACHE_DEFAULT})
49+
if(pyAMReX_CCACHE)
50+
set_ccache()
51+
endif()
4452

4553

4654
# Output (build) Directories ##################################################

docs/source/install/cmake.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ By default, the most important dependencies of pyAMReX are automatically downloa
108108
CMake Option Default & Values Description
109109
============================= ============================================== ===========================================================
110110
``BUILD_SHARED_LIBS`` ON/**OFF** Build shared libraries for dependencies
111-
``CCACHE_PROGRAM`` First found ``ccache`` executable. Set to ``-DCCACHE_PROGRAM=NO`` to disable CCache.
111+
``pyAMReX_CCACHE`` **ON**/OFF Search and use CCache to speed up rebuilds.
112112
``pyAMReX_amrex_src`` *None* Path to AMReX source directory (preferred if set)
113113
``pyAMReX_amrex_repo`` ``https://github.com/AMReX-Codes/amrex.git`` Repository URI to pull and build AMReX from
114114
``pyAMReX_amrex_branch`` *we set and maintain a compatible commit* Repository branch for ``pyAMReX_amrex_repo``

0 commit comments

Comments
 (0)