[CMake] autoheader

James Bigler jamesbigler at gmail.com
Tue Mar 31 11:26:25 EDT 2009


On Tue, Mar 31, 2009 at 7:04 AM, BRM <bm_witness at yahoo.com> wrote:

>
> I think the better solution would be to have the various Find functions
> (package, library, program) define a variable for that package to an
> internal list - which is what I think Marcel might have been hinting at.
> The user could add more variables to the same internal list.
>
> So essentially:
>
> # package defines its own automatically
> find_package(some package)
>    if (some_package_found)
>        -> cmake_autoheader_add_variable(has_some_package)
> ...
> # user can add it too
> cmake_autoheader_add_variable(has_some_other_package)
>
> # user controls what the output file is
> #     User can generate a C #define method (default method if no language
> is specified)
> cmake_autoheader(C, path/to/cmake/autoheader_output.h)
> #    User can generate a C++ const methods
> cmake_autoheader(CXX, path/to/cmake/autoheader_output.hpp)
> ...
>
> This would allow CMake to be a true platform for autoheaders as people
> would not have to think up variables for every project.
>
> So FindQt() would add HAS_QT and HAS_QT4 or HAS_QT3 or whatever version it
> is finding.
> Perhaps the various variables that the find_package() declares should also
> be included in the list
>
>
> Just 2 cents.
>
> Ben
>
>
> ----- Original Message ----
> From: Bill Hoffman <bill.hoffman at kitware.com>
> To: Marcel Loose <loose at astron.nl>
> Cc: cmake at cmake.org
> Sent: Tuesday, March 31, 2009 7:44:23 AM
> Subject: Re: [CMake] autoheader
>
> Marcel Loose wrote:
> > Hi Bill,
> >
> > Wouldn't it be better if CMake kept track of these variables internally.
> > I mean, usually the HAS_X variables are the result of calls to
> > check_include_file() and check_function_exists(). The Autotools handle
> > this under the hood.
> > CMake might keep a list of these variables, possibly one per check_*()
> > function. Or is there a reason to let the user handle this explicitly by
> > specifying the list of HAS_X variables in the call to
> > cmake_autoheader()?
> >
>
> check_include_file does not even have to be used, there are lots of ways to
> come up with variables that might be useful in a configured header file. I
> don't really like magic behind the scene lists getting created. Someone
> could just use a macro for check_include_file that appends to a list if they
> wanted.
>
> -Bill
> _______________________________________________
>

If this feature comes to fruition, I would like the ability to specify which
flags make it into what header.  In one project I worked on all our
configuration defines were in a single header.  This caused extremely long
recompiles if something happened to change the one autoheader.  We
eventually broke it into multiple files, and got targeted recompiles.

I also like the idea of not having to have a configure.h.in file like Hendrik
Sattler suggested (put these variables in this header here).

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090331/79534460/attachment.htm>


More information about the CMake mailing list