[CMake] SWIG CMAKE project not linked correctly

Bruce Jones bruce.david.jones at gmail.com
Fri Sep 15 09:23:42 EDT 2017


Hi,

I have a relatively simple SWIG - CMAKE project that is not linked
correctly, source files can be downloaded here:
https://drive.google.com/open?id=0B4Y0idbHnikgTUlocmQtNDY2czQ

The problem I have is if the template function Foo is implemented in the
header file, the project compiles and works successfully. If Foo is instead
implemented in the cpp file, the project compiles but fails either when
linking on at runtime on Windows and Linux respectively.

On windows the build will fail at linking with "unresolved external
symbols", as though the template function is not instantiated.

On Linux python fails to import the module with "undefined symbol".

If I build the projects by hand (not with CMake) they compile and link
successfully, and run successfully.

Any suggestions?

Cheers,
Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170915/9808587f/attachment.html>


More information about the CMake mailing list