Skip to content

Commit 3dd1843

Browse files
committed
Add EnableCCache for use in submodules
1 parent 9f085e2 commit 3dd1843

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

cmake/EnableCCache.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
if(NOT MSVC)
2+
#Check for ccache
3+
if(APPLE)
4+
find_program(CCACHE_PROGRAM NAMES ccache-lipo ccache)
5+
else()
6+
find_program(CCACHE_PROGRAM ccache)
7+
endif()
8+
mark_as_advanced(CCACHE_PROGRAM)
9+
if(CCACHE_PROGRAM)
10+
foreach(lang C CXX)
11+
# Do only set ccache compiler if we don't already use a ccache wrapper
12+
# Example: /usr/lib/ccache/g++
13+
if(NOT CMAKE_${lang}_COMPILER MATCHES "ccache")
14+
message(STATUS "Using ccache(${CCACHE_PROGRAM}) for ${lang} to speed up builds")
15+
set(CMAKE_${lang}_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
16+
endif()
17+
endforeach()
18+
endif()
19+
endif()

0 commit comments

Comments
 (0)