Skip to content

ExternalProject: Prevent URL list-splitting on special characters

See this forum discussion which first raised awareness of the problem this MR fixes: https://discourse.cmake.org/t/fetchcontent-does-not-support-properly-urls-with-brackets/8650

#25148 was initially reported for that discussion, and while it turned out to be closely related, it misidentified the underlying thing that needed to be fixed. If a URL contains special characters like parentheses and a few others, they would previously have caused some CMake commands to treat them as the start of a new list item even without any semicolon character. The change here in this MR handles that URL list more carefully and uses bracket quoting to prevent unintended list splitting on those special characters.

This MR also includes some preceding commits to clean up foreach() calls so we make it a little less likely we will encounter other list-handling problems in the future. The first commit removes one foreach() call altogether after I realised it was unnecessarily inefficient.

Merge request reports