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
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to