[CMake] autoheader

BRM bm_witness at yahoo.com
Tue Mar 31 12:13:05 EDT 2009


How about:


# Each variable can have a registered filter name - packages/programs/libraries would use their name
cmake_autoheader_add_variable(has_some_other_package, filter_name)
# 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 [filter_name_list])
#    User can generate a C++ const methods
cmake_autoheader(CXX, path/to/cmake/autoheader_output.hpp [filter_name_list])

- if filter name list is not provided, all entries are entered into the header file
- if filter is list is provided:
     - if name listed and is preceeded by an exclamation (!) then that name is not entered
     - if name is listed then it is entered
     - if name is not listed, then it is not entered

Likely it would be good to have a parameter that would specify the default behavior of the filter list - enter or not enter - for names not listed.
I think a default of 'not enter' would be good if the list is being provided, and this could be overridden and then the list becomes a 'not enter' list.

So:

# package defines its own automatically
find_package(some package)
   if (some_package_found)
       -> cmake_autoheader_add_variable(has_some_package, some_package)
...
# user can add it too
cmake_autoheader_add_variable(has_some_other_package, 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 some_other_package)
#    User can generate a C++ const methods
cmake_autoheader(CXX, path/to/cmake/autoheader_output.hpp some_package)


just another 2 cents...

Ben


----- Original Message ----
From: Bill Hoffman <bill.hoffman at kitware.com>
To: James Bigler <jamesbigler at gmail.com>
Cc: CMake <cmake at cmake.org>
Sent: Tuesday, March 31, 2009 11:45:42 AM
Subject: Re: [CMake] autoheader

James Bigler wrote:

> 
> 
> 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 <http://configure.h.in> file like Hendrik Sattler suggested (put these variables in this header here).
> 
Do you have an API suggestion?   What should this look like?

-Bill

_______________________________________________
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