[CMake] Swig Generation

Michael.Schmidt at L-3com.com Michael.Schmidt at L-3com.com
Thu Jul 15 12:09:54 EDT 2010

>Never done it myself, but reading the FAQ and the docs, I'd suggest
>something like this:
>find_package(SWIG REQUIRED)
>find_package(PythonLibs REQUIRED)
>  )
>set_source_files_properties(swig_main.i PROPERTIES
>  # SWIG_FLAGS "-includeall" # enable if needed by you
>  )
>set(SWIG_MODULE_mylib__EXTRA_DEPS swig_a.i swig_b.i regular.h)
>swig_add_module(mylib python swig_main.i regular.cxx)
>swig_link_libraries(mylib ${PYTHON_LIBRARIES})
>I hope this helps getting you started

I tried doing exactly what you suggested.  When I compile, it can't find
common headers, e.g. "Error: Unable to find 'stdio.h'". If I add
"/usr/include" to the INCLUDE_DIRECTORIES, then it complains about
"Unable to find 'gnu/stubs-32.h'" and "Unable to find 'stddef.h".


More information about the CMake mailing list