[CMake] [PATCH] support for CTEST_INITIAL_CACHE in new-style ctest script
Alexander Neundorf
a.neundorf-work at gmx.net
Thu Nov 13 03:46:25 EST 2008
-------- Original-Nachricht --------
> Datum: Wed, 12 Nov 2008 19:31:43 -0500
> Von: Bill Hoffman <bill.hoffman at kitware.com>
> An: a.neundorf-work at gmx.net
> CC: cmake at cmake.org
> Betreff: Re: [CMake] [PATCH] support for CTEST_INITIAL_CACHE in new-style ctest script
> Alexander Neundorf wrote:
> > Hi,
> >
> > the attached patch adds support for the CTEST_INITIAL_CACHE variable
> when
> > using new-style ctest commands.
> > Now ctest_configure() checks the CTEST_INITIAL_CACHE variable and if it
> is not
> > empty, AND there is no CMakeCache.txt yet, it writes the initial
> > CMakeCache.txt
> > I had a look at the code of the old-style ctest script, it seems there
> any
> > existing CMakeCache.txt is overwritten if CTEST_INITIAL_CACHE is set. Is
> this
> > correct ? Is this behaviour also wanted for the new-style commands ?
> > I think it is not necessary, because if I want to have a fresh cmake
> run, I
> > can use ctest_empty_binary_directory() before, then I will also get the
> > initial cache again.
> >
> > What do you think ?
> > Ok to commit ?
> >
>
> I am not sure I like the idea. The old style ctest was declarative in
> nature. The new one is procedural. I am not sure I like magic global
> variables affecting commands. A better way to do this would be to add
> an optional argument to ctest_configure that allows an initial cache to
> be passed into the function.
Well, it would be quite backward compatible, so it would just work for users expecting to set() this variable.
Or a quite similar solution as you propose:
set(my_cache "FOO:STRING=foo
BAR:STRING=bar
")
ctest_configure(... INITIAL_CACHE "${my_cache}")
Or a bit more different, where the user doesn't have to know about the format of the cmake cache:
set(FOO foo)
set(BAR bar)
ctest_configure(... CMAKE_VARS FOO BAR)
So the user would just tell ctest_configure() which variables to hand over to cmake, and ctest_configure() would then write the CMakeCache.txt (or a cmake script to be preloaded using -C).
Alex
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
More information about the CMake
mailing list