Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: add ZIG_BUILD_ARGS_OVERRIDE string option #19913

Conversation

BratishkaErik
Copy link
Contributor

Useful when someone wants to pass argument that is not yet exposed to CMake via "ZIG_WHATEVER" option, for example "--search-prefix" from here: #18434 .

Also change order of arguments in cmake/install.cmake to be the same as in CMakeLists.txt, so that "--prefix" can be overriden in both steps.

Also bump minimum CMake version to "3.9".

Useful when someone wants to pass argument that is not yet exposed
to CMake via `ZIG_WHATEVER` option, for example `--search-prefix` from here:
ziglang#18434 .

Also change order of arguments in cmake/install.cmake to be the same
as in CMakeLists.txt, so that `--prefix` can be overriden in both steps.

Also bump minimum CMake version to "3.9".

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
@BratishkaErik BratishkaErik force-pushed the cmake/zig-build-args-override branch from ffd8abb to 61c619f Compare May 10, 2024 16:04
@BratishkaErik
Copy link
Contributor Author

Forgot to bump CMake version in README, fixed now.

@andrewrk
Copy link
Member

why do you need to override arbitrary arguments? it does not specify intent clearly enough.

@BratishkaErik
Copy link
Contributor Author

BratishkaErik commented May 12, 2024

why do you need to override arbitrary arguments? it does not specify intent clearly enough.

For example, to pass "-Ddebug_extensions" to zig2 when building stage3. This way, we don't need to spend extra time building stage4, since all args are used together in one step (stage3).

Or if someone can't even build stage3, like in mentioned issue.

UPD: and there is no way to tell CMake from command line "build targets up to/excluding stage3" (AFAIK), and bootstrap.c builds stages with have_llvm = false, so users can't just build zig2 alone with CMake and then pass needed args to it.

@erikarvstedt
Copy link
Contributor

You can build just stage 2 with make zig2 (when using the makefile generator).

Maybe this simpler approach, which adds var ZIG_EXTRA_BUILD_ARGS to amend the existing var setup, is a better fit for just adding some args to the stage3 build.

@BratishkaErik
Copy link
Contributor Author

You can build just stage 2 with make zig2 (when using the makefile generator).

Maybe this simpler approach, which adds var ZIG_EXTRA_BUILD_ARGS to amend the existing var setup, is a better fit for just adding some args to the stage3 build.

Thank you for info, this may sound silly, but I completely forgot about this. I changed this PR complwtely, now this is a general cleanup of CMakeLists.txt and revival of #12747 .

@BratishkaErik BratishkaErik deleted the cmake/zig-build-args-override branch May 14, 2024 18:13
@BratishkaErik
Copy link
Contributor Author

You can build just stage 2 with make zig2 (when using the makefile generator).
Maybe this simpler approach, which adds var ZIG_EXTRA_BUILD_ARGS to amend the existing var setup, is a better fit for just adding some args to the stage3 build.

Thank you for info, this may sound silly, but I completely forgot about this. I changed this PR complwtely, now this is a general cleanup of CMakeLists.txt and revival of #12747 .

Oops, I closed it by removing branch and can't reopen it, new PR here #19969 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants