diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake index 2d151bf9..5d45c155 100644 --- a/cmake/CPM.cmake +++ b/cmake/CPM.cmake @@ -155,9 +155,12 @@ set(CPM_DRY_RUN CACHE INTERNAL "Don't download or configure dependencies (for testing)" ) +# ENV gets top priority to control CPM_SOURCE_CACHE location +# If it is not defined, allow user to control the location with CPM_SOURCE_CACHE_DEFAULT +# If neither are set disable CPM_SOURCE_CACHE if(DEFINED ENV{CPM_SOURCE_CACHE}) set(CPM_SOURCE_CACHE_DEFAULT $ENV{CPM_SOURCE_CACHE}) -else() +elseif(NOT DEFINED CPM_SOURCE_CACHE_DEFAULT) set(CPM_SOURCE_CACHE_DEFAULT OFF) endif()