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

Naram Qashat cyberbotx at cyberbotx.com
Sun Feb 28 02:17:05 EST 2010


On 02/27/10 17:17, Eric Noulard wrote:
> 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.

Most of our users are compiling our program under *nix and will not be using a 
GUI, which is why I was looking for a prompting solution instead.  The 
suggestion in another part of this thread about using cmake -i won't just it due 
to the number of options that come up that would be confusing to users.

Thanks,
Naram Qashat


More information about the CMake mailing list