I have a dune-project file that specifies that my ocaml compiler should be at least 4.05.0
I created a configure file to check that all I need is properly installed (using a mix of Unix.open_process_in "which <executabe>"
and dune external-lib-deps --missing @@default
) but for OCaml version I had to write:
let e = Sys.ocaml_version in
match String.split_on_char '.' e with
| major :: minor :: patchlevel :: _
when int_of_string major >= 4
&& int_of_string minor >= 5
&& int_of_string patchlevel >= 0 ->
printf "%s@," e
| _ -> printf "version < 4.05.0"
But I don't like it that much because if I ever need to change the version requirement, it won't propagate to this check and I'll have to change it manually.
Is there a way to do it like I check that all the OCaml packages needed are installed with dune external-lib-deps --missing @@default
? (And not necessarily only for the OCaml compiler but for each package that is bound to a version?)
Since the dependency specification is a logical expression I hoped that the solver behind opam could do it for me because I can't implement a SMT Solver in my configure file.