[Cmake] ADD_CUSTOM_COMMAND and dependency checking

Zachary Pincus zpincus at stanford.edu
Tue, 17 Feb 2004 16:45:42 -0800


Hello,

I know that I should have been able to figure this out, but I'm stupmed.
I've got a custom command in CMakeLists.txt which makes an output file. 
ccmake creates a reasonable-looking makefile, but then the actual build 
process terminates because cmake.check_depends can't find the rule to 
make the target created by my custom command. (This target IS in the 
makefile, even!)

Here are the specifics:
Using cmake 1.8.3 on Mac OS X 10.3

Here's the relevant bit of the CMakeLists.txt file:
SET(SRC_NAME_ROOT Wrapper)
ADD_CUSTOM_COMMAND(
			SOURCE ${SRC_NAME_ROOT}.i
			OUTPUTS ${SRC_NAME_ROOT}_wrap.c
			COMMAND swig
			ARGS -python ${SRC_NAME_ROOT}.i
			TARGET ${SRC_NAME_ROOT} )

The error that I get when I type make is:
No rule to make target `/path/to/folder/Wrapper_wrap.c', needed by 
`cmake.check_depends'.

This despite the fact that there IS the following rule in the generated 
makefile:
Wrapper_wrap.c:  Wrapper.i
          at echo "Building Custom command Wrapper_wrap.c..."
         swig -python Wrapper.i

I've tried all of the obvious tweaks to the ADD_CUSTOM_COMMAND (e.g. 
ditching the SOURCE and/or TARGET directives, etc.)

Any suggestions on why I'm getting this error?

Thanks,

Zach Pincus

Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine