[CMake] Problem with generated source and header files

Marcel Loose loose at astron.nl
Thu Jul 2 06:13:19 EDT 2009


Hi Joerg,

As far as I know there's no hook in CMake to do this. Did you try Eric's 
suggestion already?

Best regards,
Marcel Loose.


On Thursday 02 July 2009 10:51:23 Jörg Förstner wrote:
> Hi,
>
> > Anyway, IMHO, the effort of keeping a list of source files
> > up-to-date is much
> > less than writing the content of these sources files.
>
> Keeping/generating the list of source files is easy, that's not the
> problem.
>
> The problem is, _when_ the list can be generated.
> And _when_ cmake includes/processes this list.
>
> If the list is generated in the cmake process, there seems to be no way of
> re-importing it within the cmake run. An automated 2-pass cmake/make run
> also seems not to be possible.
> (manually running cmake/make two times is not desired)
>
> Is there a possibility to do things in between cmake evaluating the
> CMakeLists.txt files and cmake executing the commands in the CMakeLists.txt
> files (some kind of a "hook")?
>
> Regards,
> Joerg
>
> > -----Ursprüngliche Nachricht-----
> > Von: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org]
> > Im Auftrag von Marcel Loose
> > Gesendet: Donnerstag, 2. Juli 2009 09:57
> > An: cmake at cmake.org
> > Betreff: Re: [CMake] Problem with generated source and header files
> >
> > Hi James,
> >
> > On Wednesday 01 July 2009 15:58:12 James C. Sutherland wrote:
> > > > So, in general, when using globbing, YOU are responsible
> >
> > for rerunning
> >
> > > > CMake whenever you've added a source file. Otherwise you run the
> > > > risk of
> > > > the new file not being compiled. Furthermore, you might
> >
> > accidentally
> >
> > > > compile sources that were just lying around in your
> >
> > directory as test
> >
> > > > code. Deletion of sources can also cause interesting
> >
> > effects if you
> >
> > > > create a library, because the object will remain in that
> >
> > library until
> >
> > > > you (manually) remove and recreate the library.
> > > >
> > > > I hope my examples convinced you enough that globbing is (in
> > > > general) a
> > > > bad idea.
> > >
> > > So is it common practice among users of CMake to manually create and
> > > maintain a list of all files that are to be compiled, even if such a
> > > list is very large and may involve several directories and
> > > subdirectories?
> >
> > I can't talk for others, but I think it's more the rule than
> > the exception.
> > But no-one forbids you to use globbing. It's just that you
> > should be aware of
> > the consequences; things can go wrong in very subtle ways.
> >
> > Anyway, IMHO, the effort of keeping a list of source files
> > up-to-date is much
> > less than writing the content of these sources files.
> >
> > Just my 2 cents.
> >
> > Regards,
> > Marcel Loose
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list