[CMake] Make-ing specific target in a SWIG module

Bill Spotz wfspotz at sandia.gov
Wed Dec 22 01:13:39 EST 2010


Hello,

I have a CMake build system that includes a subdirectory that builds a python interface using SWIG.  I would like to run make with a target specified such that the swig command is called but the resulting wrapper file is not compiled.  The CMakeLists.txt file that controls this part of the build is in

    packages/PyTrilinos/src

and the build directory where the python interface gets built is

    BUILD/packages/PyTrilinos/src

After hunting around for the Makefile target that defines how to call swig, I found one in

   BUILD/packages/PyTrilinos/src/CMakeFiles/TriUtils.dir/build.make

which uses a relative path relative to the BUILD directory to define the target:

    packages/PyTrilinos/src/TriUtilsPYTHON_wrap.cpp: ../packages/PyTrilinos/src/TriUtils.i
        ...

My problem is I cannot figure out how to invoke this.  Since the paths are relative to the BUILD directory, I tried it from there:

    $ cd BUILD
    $ make packages/PyTrilinos/src/TriUtilsPYTHON_wrap.cpp
    make: *** No rule to make target `packages/PyTrilinos/src/TriUtilsPYTHON_wrap.cpp'.  Stop.

Any other directory to call it from doesn't make sense to me, given how the paths are specified.  I probably need to use 'make -f', but it is not even clear which Makefile to reference.  Does anyone have any advice on how to get this to work?

Thanks

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-0154      **
** Albuquerque, NM 87185-0370    Email: wfspotz at sandia.gov **




More information about the CMake mailing list