[llvm-dev] --enable-bindings=none equivalent with CMake

Dan Liew via llvm-dev
Thu, 14 Jan 2016 17:31:08 -0000

>> What's the correct switch?
>
> Is there no switch?

AFAICT there is no switch to disable the bindings. If you take a look
at ``cmake/config-ix.cmake`` the only conditional guarding
``find_package(Ocaml)`` is ``WIN32``.

The current behaviour looks like (for both OCaml and Go) if not on
Windows CMake will try to detect them and if it fails the bindings
will be disabled.

I'd happily review a patch that adds the behaviour you want. You could
add a CMake cache variable called LLVM_ENABLED_BINDINGS that is a list
(i.e. separated by ``;``) of bindings to enable.

We would need to decide what the different behaviours would need to
be. In some circumstances you want the configure to continue even if
certain things (e.g. OCaml) aren't found and in other situations (i.e.
certain bindings were explicitly requested) you want the configure to
fail if those things (e.g. OCaml) aren't found.

One possible way would be to have the following possible list element values

* ``auto``. Preserves the existing behaviour and is the default. This
will try to enable all bindings, if a particular binding cannot be
built then a non-fatal message will be emitted and configuring will
continue. Mixing ``auto`` with other possible list element values is
an error.
* ``go`` - the go bindings
* ``ocaml`` - the ocaml bindings

Setting the list to empty would disable building all bindings.