← Back to team overview

dolfin team mailing list archive

Re: CMake and SWIG header files.

 

On Thursday September 16 2010 09:14:08 Johannes Ring wrote:
> 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:

I cannot have a double quote in the string when the string is defined using 
one. CMake thinks the command ends. Escaping did not help either. I let regexp 
do the job instead.

Johan

> 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
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



References