FetchContent's dependency provider feature does not support all function names like cmake_language(CALL) and cmake_language(DEFER)
Currently, any string may be passed into function()
, including ::
and emoji, such as 🈯
. This also allows for calling these functions via cmake_language(CALL)
without issue, allowing for a variety of explicit dynamic calls. However, this capability does not work for FetchContent, which results in the following error (I've confirmed this happens with CMake 3.27 and CMake 3.28):
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FetchContent.cmake:1916:EVAL:1:
Parse error. Expected a command name, got unquoted argument with text
"my::provider".
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.26/Modules/FetchContent.cmake:1916 (cmake_language)
CMakeLists.txt:20 (FetchContent_MakeAvailable)
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FetchContent.cmake:1916 (cmake_language):
cmake_language unknown error.
Call Stack (most recent call first):
CMakeLists.txt:20 (FetchContent_MakeAvailable)
From what I've been able to gather this is due to a call to cmake_language(EVAL CODE ...)
trying to call the CMake provider as a normal CMake function, and not via cmake_language(CALL)
. This makes it difficult to create "hard to call outside of dependency provider context" functions.