Allow ExternalProject_Add to run commands with PowerShell or MSys2 on Windows

ExternalProject_Add() will, on Windows, run commands through a .bat file (for cmd.exe) when it seems the line is long. This is really good and tends to work really well.
Unfortunately, when compiling FFmpeg, I am currently also running into Windows’ command-line length on .bat files, as I have too many codecs, demuxers, etc. turned on/off.
It would be great if ExternalProject_Add would run its commands (based on a user option perhaps) with either a PowerShell script or an MSys2 script, rather than a cmd.exe .bat file, as neither of those have command-line limitations I believe.

2 Likes

We can’t just change the shell used to run commands. Despite warnings telling people not to do so, many projects rely on all sorts of behaviours of the shell that is currently used. Any change would break quite a lot of projects.

It may be possible to add an option to specify using a different shell, but I don’t have the bandwidth to explore or implement such a change myself (I’m probably the nominal maintainer of ExternalProject and FetchContent these days). If someone wants to take that up, I’d suggest they open a feature request in the issue tracker and discuss the proposal there first.

1 Like