← Back to team overview

dolfin team mailing list archive

Re: CMake and SWIG header files.

 

On Thu, Sep 16, 2010 at 5:52 PM, Johan Hake <johan.hake@xxxxxxxxx> wrote:
> Hello!
>
> SWIG is not run when a header file is changed. This might be pleasant for
> someone, but I think we should rebuild the SWIG interface.
>
> I tried adding this
>
> # and the DOLFIN header files
> execute_process(
>  COMMAND ${PYTHON_EXECUTABLE} -c 'import sys; sys.stdout.write("
> ".join([r"${DOLFIN_SOURCE_DIR}/"+l.split("\"")[1] for l in
> open("kernel_modules.i").readlines() if "%include" in l]))'
>  OUTPUT_VARIABLE SWIG_KERNEL_MODULES
> )
>
> in the CMakeList file, but it cannot be executed as I get the error
>
>  File "<string>", line 1
>    'import
>
> The command executes fine at the command line though. So I figure it has to be
> something CMake does. I have to use a double quote (") in the command and
> therefore I cannot use it as delimiters for the command.
>
> Any other good suggestions of how to get these files within cmake?

I'm not sure what you expect SWIG_KERNEL_MODULES to look like, but how
about this:

execute_process(
 COMMAND ${PYTHON_EXECUTABLE} -c "import
sys;sys.stdout.write(';'.join([r'${DOLFIN_SOURCE_DIR}/'+l.split('\"')[1]
for l in open('${CMAKE_CURRENT_SOURCE_DIR}/kernel_modules.i').readlines()
if '%include' in l]))"
 OUTPUT_VARIABLE SWIG_KERNEL_MODULES
)

?

Or perhaps you can use the HEADERS variable defined in
dolfin/CMakeLists.txt instead?

Johannes



Follow ups

References