[CMake] SWIG out of place comprehension

Michael Powell mwpowellhtx at gmail.com
Mon Oct 30 08:27:21 EDT 2017


Hello,

I've been working on some SWIG Interface (.i) files that are basically
working and gen-ing up target language source.

I've also got some complementary source that I want to incorporate
into a target language target language library.

>From what I understand CMake does offer SWIG support. But what exactly
does it do? How do I need to present my source?

For instance, if I've got my source arranged like this:

/path/to/src
/path/to/src/a
/path/to/src/b

Then I've also currently got my SWIG "in place" with the source as
well, like this;

/path/to/src/csharp
/path/to/src/a/csharp
/path/to/src/b/csharp

In this case, my target language is C#. This is all working well
enough in and of itself and I have the generated source landing in a
directory parallel to "/path/to/src/", named "/path/to/gen/", as well
as any predetermined modules presented in "/path/to/src/csharp/", in
this case.

This is also all pre-CMake, before CMake establishes any out of place contexts.

All that being said, what does the CMake SWIG help do in terms of
consuming/processing the SWIG interface files?

It seems to me, things to consider are things like what the include
directories ought to be. I've been identifying /path/to/ as the
include directory, and using "src/...", "src/a/...", "src/b/..." as
the includes within the interface files, for example.

However, I wouldn't be surprised if I needed to do some SED to root
those correctly with the CMake/SWIG working directory and/or include
directory.

Thoughts? Hints? Tips? Tricks?

Thank you!

Cheers,

Michael Powell


More information about the CMake mailing list