[cmake-developers] [CMake] Forwarding parameters to cmake through cmake-gui

Matthew Woehlke matthew.woehlke at kitware.com
Tue Nov 5 14:56:06 EST 2013


On 2013-11-05 14:36, Alexander Neundorf wrote:
> I tried the following a few times in the past and noticed everytime that it
> does not work:
> $ cd src
> src/ $ mkdir build
> src/ $ cd build
> src/build/ $ cmake-gui -DSOME_VARIABLE=some_value ..
>
> I'd like that to work. Would it work with your proposal ?

Yes.

> Once the cache is deleted in cmake-gui, I would expect that the values from
> the command line are also forgotten, also the -U values. Otherwise this cmake
> would remove the matching entries from every cache I load.

True. (But what if that's what you want?)

The biggest problem is, what if you run cmake-gui without specifying a 
build directory? In that case, whatever comes up initially is as likely 
as not *not* the directory you want to apply options to.

What about having an option (e.g. a combo box) when to apply command 
line options?

- At startup (only initial / specified on command line build directory)
- New projects (when no CMakeCache.txt exists yet, but also at startup)
- Unconfigured projects (per my original proposal)
- Always (i.e. when selecting a different build directory)

The default could be 'new projects' if no build directory is specified 
on the command line (probably you are giving "common" rather than 
project specific options in this case), otherwise 'at startup' (more 
chance options are project specific).

-- 
Matthew




More information about the cmake-developers mailing list