[Cmake] generating source

Andy Cedilnik andy . cedilnik at kitware . com
Wed, 17 Dec 2003 13:58:26 -0500


Hi Doug,

Try:


ADD_CUSTOM_TARGET(
		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/types.cpp
		DEPENDS gencode
		COMMAND ${EXE_DIR}/gencode
		ARGS test
	)
ADD_LIBRARY(common ${CMAKE_CURRENT_BINARY_DIR}/types.cpp)

			Andy

On Wed, 2003-12-17 at 13:47, Doug Henry wrote:
> the mastering cmake book states that you can generate source files by
> doing this (e.g. gencode creates types.cpp and types.h):
> 
> 	ADD_EXECUTABLE(gencode gencode.cpp)
> 	TARGET_LINK_LIBRARIES(gencode somelibs)
> 
> 	ADD_CUSTOM_TARGET(
> 		OUTPUT types.cpp
> 		DEPENDS gencode
> 		COMMAND ${EXE_DIR}/gencode
> 		ARGS test
> 	)
> 
> 	ADD_LIBRARY(common types.cpp)
> 
> but when I run cmake it gives me this error message:
> 
> 	CMake Error: can not find file /local/workspace/dswng/gencode/types.cpp
>  
> 	Tried .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h++ .hm .hpp .hxx .in .txx
> 
> What am I missing?
> 
> Thanks
> 
> _______________________________________________
> Cmake mailing list
> Cmake at www . cmake . org
> http://www . cmake . org/mailman/listinfo/cmake