Skip to content

Commit c3807eb

Browse files
authored
circumvent bug in cmake <3.30.3 (#605)
Co-authored-by: Avus <[email protected]>
1 parent 9ddfe1b commit c3807eb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmake/CPM.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,9 @@ function(CPMAddPackage)
884884
# Calling FetchContent_MakeAvailable will then internally forward these options to
885885
# add_subdirectory. Up until these changes, we had to call FetchContent_Populate and
886886
# add_subdirectory separately, which is no longer necessary and has been deprecated as of 3.30.
887+
# A Bug in CMake prevents us to use the non-deprecated functions until 3.30.3.
887888
set(fetchContentDeclareExtraArgs "")
888-
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28.0")
889+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.30.3")
889890
if(${CPM_ARGS_EXCLUDE_FROM_ALL})
890891
list(APPEND fetchContentDeclareExtraArgs EXCLUDE_FROM_ALL)
891892
endif()
@@ -911,7 +912,7 @@ function(CPMAddPackage)
911912
if(CPM_SOURCE_CACHE AND download_directory)
912913
file(LOCK ${download_directory}/../cmake.lock RELEASE)
913914
endif()
914-
if(${populated} AND ${CMAKE_VERSION} VERSION_LESS "3.28.0")
915+
if(${populated} AND ${CMAKE_VERSION} VERSION_LESS "3.30.3")
915916
cpm_add_subdirectory(
916917
"${CPM_ARGS_NAME}"
917918
"${DOWNLOAD_ONLY}"
@@ -1113,7 +1114,7 @@ function(cpm_fetch_package PACKAGE DOWNLOAD_ONLY populated)
11131114
string(TOLOWER "${PACKAGE}" lower_case_name)
11141115

11151116
if(NOT ${lower_case_name}_POPULATED)
1116-
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28.0")
1117+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.30.3")
11171118
if(DOWNLOAD_ONLY)
11181119
# MakeAvailable will call add_subdirectory internally which is not what we want when
11191120
# DOWNLOAD_ONLY is set. Populate will only download the dependency without adding it to the

0 commit comments

Comments
 (0)