In order to prompt for a password, you would need to use the USES_TERMINAL_DOWNLOAD, USES_TERMINAL_UPDATE and possibly other USES_TERMINAL_... keywords. Each one should be followed by a true value (TRUE, YES, 1, …). This gives CMake access to the terminal to ask for a password. From there, it is up to whatever is invoking CMake to ensure a terminal is actually available. CMake can’t do much if a suitable terminal isn’t provided.
In general though, I would strongly recommend not relying on providing a password as input. Instead, try to use something like ssh-agent so that CMake can run non-interactively.