[CMake] Fwd: SWIG + install

Dan Tihelka dtihelka at kky.zcu.cz
Tue Nov 7 20:34:15 EST 2006


Hallo all,

I have become quite familiar with the basic use of SWIG from CMake. However,
 I still have two things unresolved. Hopefully, it will not be an big
problem ...

The first think is: how to tell to SWIG other parameters? I have:

SET_SOURCE_FILES_PROPERTIES(MyModule.i PROPERTIES CPLUSPLUS  ON)
SET_SOURCE_FILES_PROPERTIES(MyModule.i PROPERTIES SWIG_FLAGS
"-I${CMAKE_CURRENT_SOURCE_DIR}/../")

to tell SWIG to include also .i files from one directory up (platform
independent .i files are placed there.) But, I need to tell SWIG to add the
name of package -package ,,,, for java wrapper:

SET_SOURCE_FILES_PROPERTIES(MyModule.i PROPERTIES SWIG_FLAGS "-package
my_module")

But, it does not work. I think that the second set overwrites the first set.
So the question is: how to join more parameters set to SWIG. I would like to
note, that I build wrappers for several languages in one step (python, perl,
java, ...)


And the second think is how to create install target for those wrapped
languages. My first idea was to use INSTALL(FILES ...) - or the old
INSTALL_FLES - command and specify the mask of the files to install in each
wrapped language, e.g. *.py + _*.so  for python, *.java + *.so for java, etc.
However, the list of files to install (in cmake_install.cmake) is generated
BEFORE those files are generated (e.g. during ccmake call), so it is usually
empty. Moreover, the default path to serach for the files given by the regexp
is the CMAKE_CURRENT_SOURCE_DIR, not the build dir. The use of
INSTALL_TARGETS installs the library only, but not the wrapper file.

The question, therefore, is. How to create install target for files generated
by SWIG (both wrapper file(s) and library). Note, that, e.g. for java,
several wrapp files are generated, and their names does not have to match the
original .i files.

Thank you very much for your answers, any help will be appreciated.
Dan T.



More information about the CMake mailing list