[CMake] custom generated header files problems

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Jun 9 11:24:48 EDT 2005


hello,
	I am trying to to use the latest CVS version of cmake and I am having 
some problems with the ADD_CUSTOM_COMMAND. I am hoping that the next 
release of cmake we will be able to uses on our project. I am currently 
using linux, and I am trying to report the build to windows. This bit 
of code used to work with certain cvs versions of cmake, but has 
stopped working in the past month. In this part of my project the code 
has several subdirectories, which are all used to form one library. I 
narrowed it down to a small bit of code:

ADD_CUSTOM_COMMAND(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foo/foo.h
     COMMAND touch
     ARGS ${CMAKE_CURRENT_BINARY_DIR}/foo/foo.h
     MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/foo/foo.h.in
)


SET_SOURCE_FILES_PROPERTIES(foo/foo.cpp
   PROPERTIES
   OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/foo/foo.h"
)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/foo)

ADD_LIBRARY(my foo/foo.cpp)

This code is used to generate header files. The error I am getting on 
linux is that cmake doesn't know how to make foo.h. I don't think that 
this is correct behavior!

One of the complications of this bit of code is getting some of the 
dependencies working. So that it gets build before the source. The 
automatic dependences for headers does not work for this be cause the 
header is generated. However it does work for headers generated with 
CONFIGURE_FILE. A nice feature which could be added to the 
ADD_CUSTOM_COMMAND would be to add an option for it to get build the 
same time CONFIGURE_FILE added, but there would need to be restriction 
places on the dependencies of the custom target.


Thanks,
Brad


========================================================
Bradley Lowekamp
Management Systems Designers Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
'blowekamp at mail.nih.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1962 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20050609/dbd0f693/attachment.bin


More information about the CMake mailing list