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

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 15:12:41 PDT 2017


mgorny added a comment.

In https://reviews.llvm.org/D35898#824549, @whitequark wrote:

>   message(FATAL_ERROR "LLVM_OCAML_OUT_OF_TREE cannot be enabled while on Debug mode. Use -DCMAKE_BUILD_TYPE=Release instead.")
>   
>
> Why not just ignore CMAKE_C_COMPILER &c when building out of tree? What's the problem here exactly? This seems like an arbitrary restriction.


The problem is that I can't pass `-DNDEBUG` to the build because it does not respect CFLAGS. 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). It caused buildbots to fail because the compiler used for OCaml did not support flags needed for LLVM. On my system, it would cause random build failures because I always put full compiler version in CC/CXX, so everytime I upgrade compiler, packages that hardcode CC instead of respecting what I pass to it fail horribly.

So it's either respecting CMAKE_* and building OCaml just like the rest of LLVM, or adding extra variables so that I can enforce sane compiler+flags for the build. I don't think there's really a point in adding extra variables to make OCaml special unless reusing what's in there for LLVM already causes trouble.


https://reviews.llvm.org/D35898





More information about the llvm-commits mailing list