[CMake] custom generated header files problems

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Jun 9 13:19:36 EDT 2005


Thanks!

Ok, that was the problem with this bit of test code.  But it did look 
like the same error that was being generated in my project, which use 
to work. Back to tracking down the problem.



On Jun 9, 2005, at 11:40 AM, Anton Deguet wrote:

> I just looked at it and I wonder why the ADD_CUSTOM_COMMAND has:
> OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foo/foo.h
>
> And the SET_SOURCE_FILES_PROPERTIES has:
> OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/foo/foo.h"
>
> The first one is using the BINARY_DIR and the second the SOURCE_DIR.  
> It
> might might work if you don't use an out-of-source built.
>
> Anton
>  
>
> On Thu, 2005-06-09 at 11:32, Ken Martin wrote:
> > >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
> >
> >
> > _______________________________________________
> > CMake mailing list
> > CMake at cmake.org
> > http://www.cmake.org/mailman/listinfo/cmake
> -- 
> Anton Deguet                          Systems Engineer
> NSF ERC CISST                    Johns Hopkins University
> http://cisst.org                              410 516 5261
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 5216 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20050609/0f4fac5a/attachment.bin


More information about the CMake mailing list