FetchContent: Fix unsetting wrong variable name after provider returns

The unset() command was using __cmake_contentNameLower before that
variable was restored from the __cmake_fcCurrentVarsStack. That means
if there had been a nested call to FetchContent_MakeAvailable(), the wrong
variable name would have been cleared (the nested name instead of the
one from the current call). That would have left the variable set upon return,
blocking the dependency provider from seeing any further calls to
FetchContent_MakeAvailable() in the current variable scope or below for the
current dependency.
This commit is contained in:
Craig Scott
2022-09-10 18:22:18 +10:00
parent a2f9e674bb
commit d9a6e0ffc8

View File

@@ -1893,13 +1893,13 @@ macro(FetchContent_MakeAvailable)
set(__cmake_fcProvider_${__cmake_contentNameLower} YES)
cmake_language(EVAL CODE "${__cmake_providerCommand}(${__cmake_providerArgs})")
unset(__cmake_fcProvider_${__cmake_contentNameLower})
list(POP_BACK __cmake_fcCurrentVarsStack
__cmake_contentNameLower
__cmake_contentName
)
unset(__cmake_fcProvider_${__cmake_contentNameLower})
unset(__cmake_providerArgs)
unset(__cmake_addfpargs)
unset(__cmake_fpargs)