Dune: Selecting library_flags based on OS type

Created on 8 Oct 2019  路  3Comments  路  Source: ocaml/dune

Is there an easy way to set library_flags when building on macOS but not doing that otherwise?
E.g. I'd like to express something like this

(library_flags
 (if (= %{os_type} macosx)
  (-cclib -Wl,-keep_dwarf_unwind)))

Thank you in advance.

Most helpful comment

You should be able to use (:include <filename>) (where <filename> can be generated by another rule), see https://jbuilder.readthedocs.io/en/latest/concepts.html#id2

All 3 comments

You should be able to use (:include <filename>) (where <filename> can be generated by another rule), see https://jbuilder.readthedocs.io/en/latest/concepts.html#id2

We should probably add the (if ...) form though. Included files are a bit heavy for such cases

Yes, please! I noticed that Dune has boolean constructors, but not boolean eliminators (at least not general ones).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bobzhang picture bobzhang  路  7Comments

bbc2 picture bbc2  路  7Comments

jeremiedimino picture jeremiedimino  路  5Comments

Lelio-Brun picture Lelio-Brun  路  6Comments

c-cube picture c-cube  路  7Comments