The latest CMake docs for ExternalProject_Add() describe how to use the directive to download external dependencies through version control systems like Git, Subversion, and others.
The docs also mention a section called “Terminal Access Options” (since 3.4) that grant various steps access to the terminal. However, for at least Subversion in the download step, CMake hard codes “–non-interactive” to the Subversion checkout command
- https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/ExternalProject.cmake#L2534
set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision} --non-interactive ${svn_trust_cert_args} ${svn_user_pw_args} ${src_name})
The easiest way to test this is to:
ExternalProject_Add(
myextdep
USES_TERMINAL_DOWNLOAD true
SVN_REPOSITORY https://example.com/path/to/username-password/protected/repo
)
One workaround would have been to use the SVN_USERNAME
and SVN_PASSWORD
options to ExternalProject_Add()
. However that does not work when the username/password is not predictable, nor in situations where we cannot put username/passwords into cmake scripts, or piped in with environment variables, etc. The desired behaviour I would have expected would pause the Subversion checkout process with a prompt asking for the Subversion username/password as if the user ran the “svn co …” command directly. This is why the USES_TERMINAL_*
options exist, right?
I considered adding submitting a patch rather than raise a discussion here, but I do not believe fixing Subversion in the Download step is the complete solution. I am not sure how wide this bug effects. Is it all VCS types? Is it all USES_TERMINAL_*
flags?
I’m hoping someone with more historical knowledge of the ExternalProject_Add functionality can chime in. Is this a bug? Or am I using ExternalProject_Add()
+ USES_TERMINAL_*
incorrectly?
Thanks in advacned!