[CMake] Newbie question: generated header file howto

2008-01-10 Thread Pacesie
Hello,

In my C++ program I want to auto-generate a header ( .h ) file, which is
included in most sources. I use ADD_CUSTOM_COMMAND to generate it, but I
don't know how to neatly write the dependency to it.

I could use ADD_DEPENDENCY to add the generated header to all final targets,
but it will get messy if I have lots of targets and generated headers.

Is there a way such that generated-files are checked in each invocation of
make without explicitly referring it as a dependency to something? ie.
generated file as a final target, like ADD_CUSTOM_TARGET with the ALL option
but not phony.

Regards
Pacesie
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Newbie question: generated header file howto

2008-01-10 Thread Bill Hoffman

Pacesie wrote:

Hello,

In my C++ program I want to auto-generate a header ( .h ) file, which is 
included in most sources. I use ADD_CUSTOM_COMMAND to generate it, but I 
don't know how to neatly write the dependency to it.




Add the .h file as a source file of the target that uses it.

-Bill
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Newbie question: generated header file howto

2008-01-10 Thread Pacesie
On Jan 10, 2008 11:50 PM, Bill Hoffman [EMAIL PROTECTED] wrote:

 Pacesie wrote:
  Hello,
 
  In my C++ program I want to auto-generate a header ( .h ) file, which is
  included in most sources. I use ADD_CUSTOM_COMMAND to generate it, but I
  don't know how to neatly write the dependency to it.
 

 Add the .h file as a source file of the target that uses it.

 -Bill



If I want to generate document files as part of the build, should I first
create an ADD_CUSTOM_TARGET then have it depends on the generated files
defined by ADD_CUSTOM_COMMAND? ( It would be nice if file generation can be
defined as a target so the extra step is not needed. )

Do the targets always run by the order that they are defined in CMakeLists
(unless there are dependency) ? So that if I want to be sure a target is run
before all others, I define it first in CMakeLists?

Thank you,
Pacesie
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Newbie question: generated header file howto

2008-01-10 Thread Alan W. Irwin

On 2008-01-11 08:05+1100 Pacesie wrote:


If I want to generate document files as part of the build, should I first
create an ADD_CUSTOM_TARGET then have it depends on the generated files
defined by ADD_CUSTOM_COMMAND? ( It would be nice if file generation can be
defined as a target so the extra step is not needed. )


You can generate the files by the appropriate custom target command, but that
will get executed for every make command so normally custom targets are
done without any associated command, and instead file depend on custom
commands (which are only run if the output file actually needs updating).



Do the targets always run by the order that they are defined in CMakeLists
(unless there are dependency) ? So that if I want to be sure a target is run
before all others, I define it first in CMakeLists?


If order is important between your various targets, enforce that with a
target dependency.

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__

Linux-powered Science
__
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake