Skip to content

Commit

Permalink
Add ccache option (colmap#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahojnnes authored Jan 23, 2022
1 parent 2f323fd commit d328534
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ option(OPENGL_ENABLED "Whether to enable OpenGL, if available" ON)
option(TESTS_ENABLED "Whether to build test binaries" OFF)
option(ASAN_ENABLED "Whether to enable AddressSanitizer flags" OFF)
option(PROFILING_ENABLED "Whether to enable google-perftools linker flags" OFF)
option(CCACHE_ENABLED "Whether to enable compiler caching, if available" ON)
option(CGAL_ENABLED "Whether to enable the CGAL library" ON)
option(BOOST_STATIC "Whether to enable static boost library linker flags" ON)
set(CUDA_ARCHS "Auto" CACHE STRING "List of CUDA architectures for which to \
Expand Down Expand Up @@ -254,6 +255,19 @@ else()
message(STATUS "Disabling OpenGL support")
endif()

if(CCACHE_ENABLED)
find_program(CCACHE ccache)
if(CCACHE)
message(STATUS "Enabling ccache support")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
else()
message(STATUS "Disabling ccache support")
endif()
else()
message(STATUS "Disabling ccache support")
endif()

if(PROFILING_ENABLED)
message(STATUS "Enabling profiling support")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lprofiler -ltcmalloc")
Expand Down

0 comments on commit d328534

Please sign in to comment.