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

Bill Hoffman bill.hoffman at kitware.com
Wed Dec 22 09:51:23 EST 2010


On 12/22/2010 1:13 AM, Bill Spotz wrote:
> 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?
>

Does this work:
cd BUILD/packages/PyTrilinos
make TriUtilsPYTHON_wrap.cpp

Also, you can type:

  make help

in various directories to find all the available targets in a given 
directory.


-Bill


More information about the CMake mailing list