[CMake] cmake config.h

luxInteg lux-integ at btconnect.com
Sat Nov 27 21:41:43 EST 2010


On Saturday 27 November 2010 14:24:01 Clifford Yapp wrote:
> To the best of my knowledge, there is no automatic feature available
> in CMake for this. Fortunately, it is not terribly hard to set up
> something reasonably functional yourself with a few Macros -
> autoheader uses some fairly standard naming conventions.  For BRL-CAD
> I've wrapped the key tests in macros that check for a filename stored
> in some standard global variable (CONFIG_H probably, but I don't
> recall) and if that variable does indeed have a filename the macro
> appends the appropriate line to the file.  For bonus points, write out
> a config.h.in file using (again, IIRC) #cmakedefine lines and then run
> configure_file - this ensures the CMakeLists.txt logic gets a chance
> to clear out something based on conditionals that a simple
> functionality check might include (say, for example, you check for
> something on system, find it, and then discover later in the build
> logic that the user wants the Boost version, if Boost is found...
> usually you can structure to avoid these situations but conceptually
> its often simpler to be able to have configure_file pronounce the
> "final" judgment on variables at the end of the process.  You can
> check the cmake branch of the BRL-CAD svn on sourceforge for an
> example; while I make no claim the setup is optimal it does seem to
> work.
> 
> One thing you won't find (yet) is a library of autoconf-compat
> functions to replicate the specialized tests that autoconf provides -
> there has been some discussion about that but as yet no concerted,
> organized effort to put together a library file.  Hopefully as more
> projects undergo this process something will coalesce and even become
> standard in CMake.
> 


Thanks and   keep up the good work.




More information about the CMake mailing list