[CMake] [Module] New FindSWIG / UseSWIG
Mathieu Malaterre
mathieu.malaterre at gmail.com
Fri Apr 20 10:14:00 EDT 2007
Hello,
I was pretty unhappy with the current swig support in cmake, so I
decided to rewrite it from scratch. You can find my work here:
$ svn co https://gdcm.svn.sourceforge.net/svnroot/gdcm/Sandbox/TestSWIG
or
http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/TestSWIG/
Feature:
You can now have a library foo and a swig module foo defined in the
same CMakeLists.txt and have all other commands (install,
target_link_libraries) work out of the box. Eg:
ADD_LIBRARY(foo foo.cpp)
SET_SOURCE_FILES_PROPERTIES(foo.i PROPERTIES OUTPUT_NAME foo)
SWIG_ADD_MODULE(foo-swig python $foo.i)
^^^^^^^^ logical name
and later you can decide to :
TARGET_LINK_LIBRARIES(foo-swig foo)
INSTALL(
TARGET foo-swig
LIBRARY DESTINATION lib
)
Other features:
* Allow to build swig11 or swig13 on a per .i file basis. With
automagic support of name mangling (_ and/or c postfix)
* Reuse naming convention for passing properties:
SET_SOURCE_FILES_PROPERTIES(ReadData.i PROPERTIES LANGUAGE CXX)
SET_SOURCE_FILES_PROPERTIES(ReadData.i PROPERTIES COMPILE_FLAGS
"-dnone -strict 2")
SET_SOURCE_FILES_PROPERTIES(ReadData.i PROPERTIES COMPILE_FLAGS "-Dfoo")
Comments welcome,
Mathieu
More information about the CMake
mailing list