[CMake] autoheader

James Bigler jamesbigler at gmail.com
Tue Mar 31 12:33:59 EDT 2009


On Tue, Mar 31, 2009 at 9:45 AM, Bill Hoffman <bill.hoffman at kitware.com>wrote:

> 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
>
>
Why not something similar to what you proposed, but without the intermediate
configure.h.in step and being able to specify comments and perhaps custom
strings.  You could also specify things multiple kinds and they all just get
inserted one after the other.  CMake could generate the .in file and use
configure_file in the background.  The point is that you don't have to
maintain two files.

set(VARS HAS_A HAS_B HAS_C)
set(STRING_VARS STRING_A STRING_B)
cmake_autoheader(
  CMAKEDEFINE_VARS ${VARS}
  STRING_VARS ${STRING_VARS}
  CUSTOM_VAR "#define \"I like @MY_VAR@\"
  COMMENT "Here's a comment"
  CMAKEDEFINE_VARS "SOME_OTHER_VAR;AND_ANOTHER;"
  HEADER ${CMAKE_BINARY_DIR}/include/config.h
  )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090331/15064f82/attachment.htm>


More information about the CMake mailing list