[CMake] custom generated header files problems

Ken Martin ken.martin at kitware.com
Thu Jun 9 11:32:22 EDT 2005


>From a quick look, your code should work.  I'll take a look at it - Ken

> -----Original Message-----
> From: cmake-bounces+ken.martin=kitware.com at cmake.org [mailto:cmake-
> bounces+ken.martin=kitware.com at cmake.org] On Behalf Of Bradley Lowekamp
> Sent: Thursday, June 09, 2005 10:25 AM
> To: CMake Mailing List
> Subject: [CMake] custom generated header files problems
> 
> 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




More information about the CMake mailing list