What I want is to be able to execute the script from the Run/Debug menu in CLion (as if it were an EXE generated by add_executable). As a custom target, it does show up in CLion’s drop down of targets, but CLion won’t run non-executable targets, such as scripts:
https://youtrack.jetbrains.com/issue/CPP-5831
However (and as I commented on that issue), I did find a work-around. Since I have Msys2 installed, I can specify msys2.exe as the Executable for CLion to run, and the script as an argument.
One thing this has made me realize is that although the script has a runtime dependency on build outputs, it doesn’t actually have a build dependency on it. In fact, the .sh file can be (and is) written during the configuration step. To my understanding, CMake doesn’t really have a way to express purely runtime dependencies:
…but that’s moot in this case as the script doesn’t take any build-time time. (What does get built at build time is custom commands used to compile the Java code for the grammar, which the .sh script then has a runtime dependency on.)