[CMake] swig

Anton Deguet anton at cs.jhu.edu
Wed Aug 24 17:30:24 EDT 2005


Hello,

I would link this request/bug to two others:
- bug #1740 (closed since duplicate, but I believe parts of the
discussion are relevant)
- bug #1731 (similar problem)

The addition of a DEPENDS_SCANNER is obviously a more flexible,
powerful, extensible solution.  The SWIG related tickets could then
easily be solved by setting  DEPENDS_SCANNER to "swig -MM".  Isn't that
a good reason to move this feature implementation a bit higher on the
priority list? :-)

Anton


On Mon, 2005-08-22 at 09:29, Brad King wrote:
> Peter Brown wrote:
> > How can I add the dependencies manually to a swig target? I have:
> 
> Hmmm...it looks like there is no way to do it using the 
> Modules/UseSWIG.cmake module that comes with CMake.  Look at the file 
> and you'll see this custom command:
> 
>    ADD_CUSTOM_COMMAND(
>      OUTPUT "${swig_generated_file_fullname}"
>      COMMAND "${SWIG_EXECUTABLE}"
>      ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
>      ${swig_source_file_flags}
>      ${CMAKE_SWIG_FLAGS}
>      ${swig_special_flags}
>      ${swig_extra_flags}
>      ${swig_include_dirs}
>      -o "${swig_generated_file_fullname}"
>      "${swig_source_file_fullname}"
>      MAIN_DEPENDENCY "${swig_source_file_fullname}"
>      COMMENT "Swig source")
> 
> In order to add dependencies there needs to be a line like
> 
> DEPENDS ${swig_extra_depends}
> 
> after the MAIN_DEPENDENCY line.  Unfortunately it doesn't look like the 
> interface to those SWIG macros was designed to enable extra dependencies 
> so even if you add the line there is no easy way to specify the value of 
> swig_extra_depends for each source file.  You can submit a feature 
> request here:
> 
> http://www.cmake.org/Bug
> 
> but meanwhile you'll have to copy UseSWIG.cmake into your project and 
> add dependency support yourself.  To get automatic dependencies you'll 
> have to hack something like what I described here:
> 
> http://www.cmake.org/pipermail/cmake/2005-August/007102.html
> 
> > ADD_DEPENDENCIES(target
> > file1.h
> > file2.h
> > ...
> > )
> > 
> > If I choose as target "module_nameRUBY_wrap.cxx", cmake complains,
> > that there is no such target. If I choose "module_name", it doesn't
> > complain, but won't check for the dependencies.
> 
> ADD_DEPENDENCIES is only for top-level targets added with ADD_LIBRARY, 
> ADD_EXECUTABLE, and ADD_CUSTOM_TARGET.  The next release of CMake 
> includes documentation for ADD_DEPENDENCIES that makes this much more clear.
> 
> -Brad
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
-- 
Anton Deguet                          Systems Engineer
NSF ERC CISST                    Johns Hopkins University
http://cisst.org                              410 516 5261



More information about the CMake mailing list