[Dune-devel] .in-file mechanism with cmake?!

Christian Engwer christian.engwer at uni-muenster.de
Wed Jul 15 16:00:56 CEST 2015


Dear cmake gurus,

I want to update an existing project to work with cmake and stumbled
again over an issue, which I was not able to solve by myself.

I currently have a file foo.ini.in with a content similar to:

[domain.test2d]
dim = 2
mesh = @top_srcdir@/src/grids/rectangle.msh
refine = 1

which allows me specify a mesh location in the source tree easily via
the generated ini file, even if I use out-of-source builds.

For autotools I added the foo.ini.in to the list of generated files
in configure.ac:

AC_CONFIG_FILES([
...
   src/foo.ini
])

Now I tried to do the same for cmake. I added to following to src/CMakeLists.txt:

configure_file(foo.ini.in foo.ini)

but configure_file doesn't know about @top_srcdir@ and similar. I fist
would have thought tis should work, as it works for Doxyfile.in, but
it doesn't. Then I check the DuneDoxygen.cmake and it seems that this
does some fancy tricks with by directly calling cmake. Is this the
official way to go? Or is there an easier way, which forks for
"simple" .in-files? If it's not the case we should consider
encapsulating the doxygen magic, as .in files could be something more
people use. At least it was a nice trick I have shown a couple of
people.

Christian





More information about the Dune-devel mailing list