diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake index f4d0eea4..ca8c3302 100644 --- a/cmake/CPM.cmake +++ b/cmake/CPM.cmake @@ -756,6 +756,7 @@ function(CPMAddPackage) "${CPM_ARGS_SYSTEM}" "${CPM_ARGS_OPTIONS}" ) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE) set(PACKAGE_INFO "${PACKAGE_INFO} at ${download_directory}") # As the source dir is already cached/populated, we override the call to FetchContent. @@ -815,6 +816,7 @@ function(CPMAddPackage) "${CPM_ARGS_SYSTEM}" "${CPM_ARGS_OPTIONS}" ) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE) endif() cpm_get_fetch_properties("${CPM_ARGS_NAME}") endif() @@ -986,6 +988,7 @@ function( set(CPM_OLD_INDENT "${CPM_INDENT}") set(CPM_INDENT "${CPM_INDENT} ${PACKAGE}:") add_subdirectory(${SOURCE_DIR} ${BINARY_DIR} ${addSubdirectoryExtraArgs}) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE) set(CPM_INDENT "${CPM_OLD_INDENT}") endif() endfunction()