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

Substitute command output inside @[Include(flags: …)] ? #60

Open
shdown opened this issue Jul 13, 2019 · 5 comments
Open

Substitute command output inside @[Include(flags: …)] ? #60

shdown opened this issue Jul 13, 2019 · 5 comments

Comments

@shdown
Copy link

shdown commented Jul 13, 2019

The LLVM example substitutes a command output inside @[Link(ldflags: …)], but not inside @[Include(flags: …)]. Is there a way to do the latter? If not, it would be nice to have it.

@RX14
Copy link
Contributor

RX14 commented Jul 19, 2019

This works since ldflags is passed directly to the shell. If you want to interpolate shell output into @[Include] you'll want to use macros

@shdown
Copy link
Author

shdown commented Jul 20, 2019

Could you please give an example of how to do this? Seems to be impossible.

@RX14
Copy link
Contributor

RX14 commented Jul 24, 2019

@[Include(..., flags: "{{`echo -Dfoo`}}")

should work

@shdown
Copy link
Author

shdown commented Jul 25, 2019

No, it does not: running crystal_lib on

@[Include(
    "llvm-c/Core.h",
    "llvm-c/BitReader.h",
    flags: "{{`llvm-config-7 --cflags`}}",
    prefix: %w(LLVM_ LLVM)
)]
lib LibLLVM_C
end

results in

error: unsupported option '--cflags`}}'
warning: {{`llvm-config-7: 'linker' input unused [-Wunused-command-line-argument]
input.c:1:10: fatal error: 'llvm-c/Core.h' file not found
lib LibLLVM_C
end

@RX14
Copy link
Contributor

RX14 commented Jul 25, 2019

yeah, seems like this doesn't work :(

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

No branches or pull requests

2 participants