[CMake] ADD_CUSTOM_COMMAND: OUTPUTS ignored when in subdir

Alexander Neundorf a.neundorf-work at gmx.net
Tue Jun 6 06:27:34 EDT 2006


> Von: Frederik Deweerdt <deweerdt at free.fr>
> 
> 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?

Prepending ${CMAKE_CURRENT_BINARY_DIR} in front of the generated file names is usually a good idea. And I would suggest not to create them in ${CMAKE_CURRENT_BINARY_DIR}/rpc/, but directly in ${CMAKE_CURRENT_BINARY_DIR}.
Maybe this helps in your case too ?

Alex

-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
      Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
    


More information about the CMake mailing list