Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
os: [ubuntu-latest, windows-2022, macos-latest]
# we want to ensure compatibility with a recent CMake version as well as the lowest officially supported
# legacy version that we define as the default version of the second-latest Ubuntu LTS release currently available
cmake_version: ['3.16.3', '3.27.5']
cmake_version: ['3.16.3', '3.27.5', '3.30.0']
exclude:
# there seems to be an issue with CMake 3.16 not finding a C++ compiler on windows-2022
- os: windows-2022
Expand Down
26 changes: 10 additions & 16 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,7 @@ function(CPMAddPackage)
)

if(NOT CPM_SKIP_FETCH)
cpm_declare_fetch(
"${CPM_ARGS_NAME}" "${CPM_ARGS_VERSION}" "${PACKAGE_INFO}" "${CPM_ARGS_UNPARSED_ARGUMENTS}"
)
cpm_fetch_package("${CPM_ARGS_NAME}" populated)
cpm_fetch_package("${CPM_ARGS_NAME}" populated ${CPM_ARGS_UNPARSED_ARGUMENTS})
if(CPM_SOURCE_CACHE AND download_directory)
file(LOCK ${download_directory}/../cmake.lock RELEASE)
endif()
Expand Down Expand Up @@ -979,17 +976,7 @@ function(CPMGetPackageVersion PACKAGE OUTPUT)
)
endfunction()

# declares a package in FetchContent_Declare
function(cpm_declare_fetch PACKAGE VERSION INFO)
if(${CPM_DRY_RUN})
cpm_message(STATUS "${CPM_INDENT} Package not declared (dry run)")
return()
endif()

FetchContent_Declare(${PACKAGE} ${ARGN})
endfunction()

# returns properties for a package previously defined by cpm_declare_fetch
# returns properties for a package previously defined by cpm_fetch_package
function(cpm_get_fetch_properties PACKAGE)
if(${CPM_DRY_RUN})
return()
Expand Down Expand Up @@ -1071,7 +1058,14 @@ function(cpm_fetch_package PACKAGE populated)
string(TOLOWER "${PACKAGE}" lower_case_name)

if(NOT ${lower_case_name}_POPULATED)
FetchContent_Populate(${PACKAGE})
FetchContent_Populate(
${PACKAGE}
QUIET
SOURCE_DIR "${CPM_FETCHCONTENT_BASE_DIR}/${lower_case_name}-src"
BINARY_DIR "${CPM_FETCHCONTENT_BASE_DIR}/${lower_case_name}-build"
SUBBUILD_DIR "${CPM_FETCHCONTENT_BASE_DIR}/${lower_case_name}-subbuild"
${ARGN}
)
set(${populated}
TRUE
PARENT_SCOPE
Expand Down