diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a7b194ff84b..9ecf6511822e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,11 +56,10 @@ mark_as_advanced(Halide_CCACHE_BUILD) if (Halide_CCACHE_BUILD) find_program(CCACHE_PROGRAM ccache REQUIRED) - # TODO: ccache recommends setting CCACHE_SLOPPINESS=pch_defines,time_macros to - # enable precompiled header caching. Our timing found it slightly faster with - # just CCACHE_SLOPPINESS=pch_defines, so that's what we're using. Maybe revisit - # if issues occur (but we don't use any of the time macros so should be irrelevant). - set(Halide_CCACHE_PARAMS CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines + set(Halide_CCACHE_PARAMS + CCACHE_CPP2=yes + CCACHE_HASHDIR=yes + CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime,include_file_ctime CACHE STRING "Parameters to pass through to ccache") mark_as_advanced(Halide_CCACHE_PARAMS) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 78501a55c541..c64f47cff05e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,6 +7,13 @@ add_executable(_test_internal internal.cpp) target_link_libraries(_test_internal PRIVATE Halide::Test) target_include_directories(_test_internal PRIVATE "${Halide_SOURCE_DIR}/src") target_precompile_headers(_test_internal PRIVATE ) +if (Halide_CCACHE_BUILD) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options(_test_internal PRIVATE + "$<$:SHELL:-Xclang -fno-pch-timestamp>" + ) + endif() +endif() add_halide_test(_test_internal GROUPS internal)