[CMake] ADD_CUSTOM_COMMAND: OUTPUTS ignored when in subdir

Frederik Deweerdt deweerdt at free.fr
Tue Jun 6 06:17:55 EDT 2006


Hi,

I'm having an issue (tested with both latest CVS and 2.4.2) with 
the ADD_CUSTOM_COMMAND directive. My CMakeLists.txt contains the
following text:

ADD_CUSTOM_COMMAND(
OUTPUT rpc/tsp_rpc_svc.c rpc/tsp_rpc_xdr.c
COMMAND rpcgen -N -C rpc/tsp_rpc.x
DEPENDS rpc/tsp_rpc.x)

... the rpc/tsp_rpc_svc.c and rpc/tsp_rpc_xdr.c files being in
turn used (in the same CMakeLists.txt file) as follows:

ADD_LIBRARY(tsp_consumer
[... other src ...]
 rpc/tsp_rpc_xdr.c
 rpc/tsp_rpc_svc.c)

The cmake command fails however with the following messages:
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h++ .hm .hpp .hxx .in .txx
CMake Error: Cannot find source file "/home/def/Prog/tsp/src/core/rpc/tsp_rpc_xdr" for target "tsp_consumer"

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h++ .hm .hpp .hxx .in .txx
CMake Error: Cannot find source file "/home/def/Prog/tsp/src/core/rpc/tsp_rpc_svc.c" for target "tsp_provider"

Now, if I remove the leading 'rpc/' from the sources name, cmake recognizes them
as a ADD_CUSTOM_COMMAND output, and no longer complains.

Do you have any suggestions, hints that could help me find the offending 
code, or am I mistaken and this is an expected behaviour?

Thanks in advance,
Frederik


More information about the CMake mailing list