Skip to content

Commit d212a13

Browse files
committed
Making cache default setting more robust.
1 parent 809d3c3 commit d212a13

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ cmake_minimum_required(VERSION 3.20)
44
project(enum-ops)
55

66
# Setup cpp-library infrastructure
7-
if(PROJECT_IS_TOP_LEVEL)
8-
set(CPM_SOURCE_CACHE ${CMAKE_SOURCE_DIR}/.cache/cpm CACHE PATH "CPM cache")
7+
if(PROJECT_IS_TOP_LEVEL AND NOT CPM_SOURCE_CACHE AND NOT DEFINED ENV{CPM_SOURCE_CACHE})
8+
set(CPM_SOURCE_CACHE "${CMAKE_SOURCE_DIR}/.cache/cpm" CACHE PATH "CPM source cache")
9+
message(STATUS "Setting cpm cache dir to: ${CPM_SOURCE_CACHE}")
910
endif()
1011
include(cmake/CPM.cmake)
1112

0 commit comments

Comments
 (0)