Skip to content

Conversation

@erikarvstedt
Copy link
Contributor

This allows building Zig with the correct dynamic linker in environments where the auto detection mechanism fails, like in Nix dev shells.

This PR is a fixed version of #19631.

else()
set(ZIG_STATIC_ARG "")
endif()

Copy link
Contributor Author

@erikarvstedt erikarvstedt Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this newline because it made no sense semantically.

@erikarvstedt erikarvstedt force-pushed the cmake-dynamic-linker branch from 1fb1c24 to de97c3b Compare April 18, 2024 09:51
@erikarvstedt
Copy link
Contributor Author

erikarvstedt commented Apr 18, 2024

An alternative would be to add a generic ZIG_EXTRA_BUILD_ARGS variable that's appended to ZIG_BUILD_ARGS.
Actually, I'd prefer this, because it avoids duplicating Zig build options in cmake.

Usage:

# Set multiple build args
cmake -DZIG_EXTRA_BUILD_ARGS="-Ddynamic-linker=/my/linker;--libc;/my/libc/file;-Dstd-docs=true" 

@andrewrk
Copy link
Member

Thanks!

@andrewrk andrewrk merged commit 130fb5c into ziglang:master Apr 18, 2024
@erikarvstedt erikarvstedt deleted the cmake-dynamic-linker branch April 18, 2024 20:13
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.

2 participants