How to install a "generated" directory?

Doing an install can’t assume doing a build is possible. In fact, the more common usage these days of an install is likely to be part of running cpack, which is in turn likely to be invoked directly rather than as part of a build. While make install and make package are both still supported use cases, it’s not how I recommend folks do either operation. I normally steer folks away from directly installing other than to a staging area, which is easiest done using cmake --install because you can specify the staging location at install time with the --prefix option. Similarly, I recommend using cpack directly rather than make package because you again have more control over how packaging is done.

I recognise you probably are focused on doing make install right now (that’s the only use case where expecting “install” to build something would even be possible), but I’d encourage you to think of building and installing as separate steps. It will help you construct a better mental picture of a smoother workflow that will keep you closer to the happy path.