[PATCH] D35898: [OCaml] Respect CMAKE_C_COMPILER & CMAKE_C_FLAGS for OCaml C files

whitequark via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 15:25:12 PDT 2017

whitequark added a comment.

> The problem is that I can't pass -DNDEBUG to the build because it does not respect CFLAGS.

This can be easily solved by only looking for -DNDEBUG in CMAKE_C_FLAGS* and then passing that specific flag in -ccopt. This works with every imaginable compiler, including MSVC.

> If I make it respect CFLAGS, the problem becomes that OCaml defaults to using a random compiler that's been hardcoded at build time and that doesn't necessarily work correctly (or even exist).

If the compiler hardcoded into ocamlc does not exist your OCaml installation is simply broken. You won't be able to compile *any* native code via the OCaml toolchain, whether that's OCaml or C stubs. I don't think the LLVM build system should work around broken OCaml installations; to handle this case, a check during configure time that ocamlc can indeed compile C files is a good idea.


More information about the llvm-commits mailing list