[CMake] Can CMake prompt the user for input while it's running?

Eric Noulard eric.noulard at gmail.com
Sat Feb 27 17:17:12 EST 2010


2010/2/27 Naram Qashat <cyberbotx at cyberbotx.com>:
> On 02/27/10 12:53, John Drescher wrote:
>>
>> On Sat, Feb 27, 2010 at 12:23 PM, Naram Qashat<cyberbotx at cyberbotx.com>
>>  wrote:
>>>
>>> I'm wondering if it's possible for CMake to prompt the user for input
>>> when
>>> it's running, as opposed to relying on passing in arguments for input.
>>>  Main
>>> reason I'm looking for something like this is so we can have optional
>>> files
>>> that can be enabled or disabled by the user when CMake is run.  Ideally
>>> this
>>> should be able to be done if a certain command-line flag is passed in.
>>>
>>
>> Minus the prompting isn't that what options are for in cmake? I
>> believe you can set them either via the gui or by the command line /
>> shell.
>>
>> John
>
> The problem is that the number of options wouldn't be static because the
> number of files that will be optional will change over time.  Which is why I
> was wondering if there was a way to have CMake prompt while it runs.  I'd
> rather avoid having an external script searching for the optional files when
> CMake would already be doing that.

When running CMake you can have some CMakeLists.txt doing:

IF(WHATEVER)
   OPTION(OPT1 OFF)
   IF (OPT1)
       OPTON(OPT12 ON)
   ENDIF(OPT1)
ENDIF(WHATEVER)

when doing such cascaded option dependent on IF the OPTIONs
do show up in CMake gui once you check them and push "configure"
again.

Now since there is a "Grouped View" based on var name in CMake gui
you should be able to emulate what you want using
"conditionnal" option + cmake gui + grouped view.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list