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

Alexander Neundorf neundorf at kde.org
Tue Nov 5 14:36:08 EST 2013


On Tuesday 05 November 2013, David Cole wrote:
> >>> My question is still not answered completely:
> >>> 
> >>> When should the new variable be added? On startup is not really
> >>> possible because it might be the case that your src/binary directory
> >>> is not set properly.
> >>> 
> >>> So you would agree that it makes sense to do it "on configure" but
> >>> only if the cache is empty? This will not allow to overwrite the
> >>> variable via parameter but I guess that usecase is not very
> >>> common?
> >> 
> >> On startup is the only time it does make sense. After that, the user
> >> should be in charge, and the command line settings should not be
> >> re-applied again after a user makes an edit. You don't need the
> >> src/binary directories set properly necessarily in order to add a
> 
> cache
> 
> >> entry to the UI.
> > 
> > ...
> > 
> > - What should happen with a -D option if there is not initially a
> 
> build
> 
> > directory selected?
> 
> It should add UI entries even though there is no build directory
> selected, and set them according to the -D values. Then, the -D values
> should be forgotten about and never applied again during that session,
> regardless of future user actions.
> 
> Also, you could require that for -D args to work properly, the current
> directory *is* the binary directory at startup time (just like cmake
> and ccmake). If you're passing -D arguments to the gui program, then
> you have control over its launching point, and can set the current
> directory to be whatever you like.
> 
> If launched without a build directory, you could choose the last known
> build directory (if there is one) just like cmake-gui does now.
> 
> If no build directory, no -D args.

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 ?

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.

Alex



More information about the cmake-developers mailing list