Skip to content

Commit

Permalink
refactor: remove an unnecessary else branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Avus-c committed Jul 15, 2024
1 parent 3e052e8 commit aff9803
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -865,29 +865,28 @@ function(CPMAddPackage)
# CMake 3.28 added EXCLUDE and SYSTEM(3.25) to FetchContent_Declare.
# Calling FetchContent_MakeAvailable will than call add_subdirectory internally with the EXCLUDE
# and SYSTEM flags. No need for CPM to do this manually anymore.
set(fetchContentDeclareExtraArgs "")
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28.0")
set(fetchContentDeclareExtraArgs "")
if(${CPM_ARGS_EXCLUDE_FROM_ALL})
list(APPEND fetchContentDeclareExtraArgs EXCLUDE_FROM_ALL)
endif()
if(${CPM_ARGS_SYSTEM})
list(APPEND fetchContentDeclareExtraArgs SYSTEM)
endif()
# For CMake version <3.28 OPTIONS are parsed in cpm_add_subdirectory
if(CPM_ARGS_OPTIONS)
foreach(OPTION ${CPM_ARGS_OPTIONS})
cpm_parse_option("${OPTION}")
set(${OPTION_KEY} "${OPTION_VALUE}")
endforeach()
endif()

cpm_declare_fetch(
"${CPM_ARGS_NAME}"
${fetchContentDeclareExtraArgs}
"${CPM_ARGS_UNPARSED_ARGUMENTS}"
)
else()
cpm_declare_fetch("${CPM_ARGS_NAME}" "${CPM_ARGS_UNPARSED_ARGUMENTS}")
endif()
cpm_declare_fetch(
"${CPM_ARGS_NAME}"
${fetchContentDeclareExtraArgs}
"${CPM_ARGS_UNPARSED_ARGUMENTS}"
)

cpm_fetch_package("${CPM_ARGS_NAME}" populated)
if(CPM_SOURCE_CACHE AND download_directory)
file(LOCK ${download_directory}/../cmake.lock RELEASE)
Expand Down

0 comments on commit aff9803

Please sign in to comment.