cmake: install zig to 'build_dir/stage3' during building
See https://github.com/ziglang/zig/issues/14240#issuecomment-1374642063
Just rebased against master.
Found a bug that may or may not affect distros' package installing 👀
What I find out so far:
- Current installing procedure invokes last command [that was used during building] again, since it assumes that custom target "stage3" is always in out-of-date state:
The target has no output file and is always considered out of date even if the commands try to create a file with the name of the target.
-
Before this patch, it wasn't a problem since all it did was (simplified) "Oh, I know that program is already compiled, finish"
-
After this patch, it started to copy files to temporary "stage3/" destination not only during building, but also during installing (1). This caused in Gentoo's Portage (perhaps other package managers too) installing these files too, because they were copied during installation. IIUC ofc, maybe I'm wrong.
Following changes splits add_custom_target(stage3 ALL and command that it invokes, so that it won't retry it when installing as target will be considered not out-of-date. I'd like to know core team's opinion whether (1) is a bug or feature or smth else.
What I find out so far:
* Current installing procedure invokes last command [that was used during building] again, since it assumes that custom target "stage3" is [always in out-of-date state](https://cmake.org/cmake/help/latest/command/add_custom_target.html):The target has no output file and is always considered out of date even if the commands try to create a file with the name of the target.
* Before this patch, it wasn't a problem since all it did was (simplified) "Oh, I know that program is already compiled, finish" * After this patch, it started to copy files to temporary "stage3/" destination not only during building, but also during installing (1). This caused in Gentoo's Portage installing these files too, because they were copied during installation. IIUC ofc, maybe I'm wrong.Following changes splits
add_custom_target(stage3 ALLand command that it invokes, so that it won't retry it when installing as target will be considered not out-of-date. I'd like to know core team's opinion whether (1) is a bug or feature or smth else.
I'm still not sure about explanation above, and sorry if my bad English made this hardly readable.
Rebased for more checks
ping
Again, new CI checks :)