Skip to content

Commit e6f3507

Browse files
authored
cmake: Simplify ccache logic
* 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
1 parent 4929f09 commit e6f3507

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# integer (MPI) library written entirely in C.
55
#
66

7-
cmake_minimum_required(VERSION 3.10)
7+
cmake_minimum_required(VERSION 3.18)
88

99
project(libtommath
1010
VERSION 1.3.0
@@ -36,15 +36,11 @@ option(BUILD_SHARED_LIBS "Build shared library and only the shared library if \"
3636
#-----------------------------------------------------------------------------
3737
# Add support for ccache if desired
3838
#-----------------------------------------------------------------------------
39-
find_program(CCACHE ccache)
39+
option(USE_CCACHE "Enable ccache" OFF)
4040

41-
if(CCACHE)
42-
option(ENABLE_CCACHE "Enable ccache." ON)
43-
endif()
44-
45-
# use ccache if installed
46-
if(CCACHE AND ENABLE_CCACHE)
47-
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
41+
if(USE_CCACHE)
42+
find_program(CCACHE ccache REQUIRED)
43+
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
4844
endif()
4945

5046
#-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)