Skip to content

Providing multiple language bindings in a project #12810

Answered by eli-schwartz
mitchgrout asked this question in Q&A
Discussion options

You must be logged in to vote

The add_languages() function allows you to add additional languages / compilers late, i.e. some time after the project() function initialization.

You can use this conditionally inside of an if/endif block, pass the required kwarg to it, read its boolean return value to see if it was able to find those languages, etc.

So you could choose to only build the C++ bindings if:

  • not cross compiling
  • a C++ compiler is available
  • the project is being used standalone as opposed to a subproject
  • an option was explicitly specified

Option 2 is the simple option, and would mean always compiling the C++ bindings if possible, and then if the parent project doesn't have a C++ compiler and yet tries to find …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mitchgrout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants