Skip to content

Commit

Permalink
cmake: Simplify ccache logic
Browse files Browse the repository at this point in the history
* Use USE_CCACHE switch, this seems to be a more common option having a quick look using Google
* Make use of find_program() functionality introduced in CMake 3.18 to simplify code
  • Loading branch information
diizzyy authored Mar 31, 2024
1 parent 4929f09 commit e6f3507
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# integer (MPI) library written entirely in C.
#

cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.18)

project(libtommath
VERSION 1.3.0
Expand Down Expand Up @@ -36,15 +36,11 @@ option(BUILD_SHARED_LIBS "Build shared library and only the shared library if \"
#-----------------------------------------------------------------------------
# Add support for ccache if desired
#-----------------------------------------------------------------------------
find_program(CCACHE ccache)
option(USE_CCACHE "Enable ccache" OFF)

if(CCACHE)
option(ENABLE_CCACHE "Enable ccache." ON)
endif()

# use ccache if installed
if(CCACHE AND ENABLE_CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
if(USE_CCACHE)
find_program(CCACHE ccache REQUIRED)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
endif()

#-----------------------------------------------------------------------------
Expand Down

0 comments on commit e6f3507

Please sign in to comment.