[CMake] SWIG_ADD_LIBRARY Documentation?

Rob McDonald rob.a.mcdonald at gmail.com
Sat Dec 9 12:22:58 EST 2017


In version 3.8, SWIG_ADD_MODULE was deprecated in favor of
SWIG_ADD_LIBRARY.  This added the ability to control the TYPE for the
target.  From the documentation, the options are this:

https://cmake.org/cmake/help/v3.8/module/UseSWIG.html

TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>

However, I can find no documentation of what these options mean and
why someone would choose one over the other.

I found some developer comments in KitWare's bug tracker proposing a
change of the default, but it looks like they left it as 'MODULE'.
https://gitlab.kitware.com/cmake/cmake/merge_requests/253

However, even which TYPE value is default appears undocumented.

If we want to generalize from ADD_LIBRARY, we can get an idea of what
some of the options generally mean:
https://cmake.org/cmake/help/v3.0/command/add_library.html

However, that says nothing for USE_BUILD_SHARED_LIBS -- which appears
to be entirely unique to SWIG_ADD_LIBRARY.  It was also the proposed
alternate default in the referenced proposal.

So, can anyone explain in the context of SWIG/C++/Python, why I would
want to choose SHARED, STATIC, or USE_BUILD_SHARED_LIBS?  What would
be the practical impact on my wrapper, how it is built, its
dependencies, etc.

Thanks for any help,

Rob


More information about the CMake mailing list