[CMake] cmake-gui's separation between configuration & generation

Robert Dailey rcdailey.lists at gmail.com
Thu Aug 23 14:24:40 EDT 2012


On Thu, Aug 23, 2012 at 1:03 PM, David Cole <david.cole at kitware.com> wrote:
> On Thu, Aug 23, 2012 at 11:50 AM, Robert Dailey <rcdailey.lists at gmail.com>
> wrote:
>>
>> On Thu, Aug 23, 2012 at 10:48 AM, Robert Dailey
>> <rcdailey.lists at gmail.com> wrote:
>> > On Thu, Aug 23, 2012 at 10:43 AM, John Drescher <drescherjm at gmail.com>
>> > wrote:
>> >>> Is the separation between configuration & generation really necessary
>> >>> for cmake-gui? I ask because several of my co-workers are confused
>> >>> between the differences in the two, even though I explain it.
>> >>>
>> >>> Honestly there isn't really a reason that I can think of to do a
>> >>> configure without a generate, unless you're testing the integrity of
>> >>> your CMake script changes maybe, but even then, if its broken
>> >>> generation won't take place.
>> >>>
>> >>> The command line program does not separate the two, so I simply think
>> >>> cmake-gui should eliminate the configure button, and simply have a
>> >>> generate button. Does this seem fair? Is there a reason why they are
>> >>> separated?
>> >>
>> >> I can think of one use case that I use that the separation is a good
>> >> thing. What about when you have options and variables that are
>> >> conditional depending on other CMake variables so that setting the
>> >> variables / options may take more than 1 configure.
>> >
>> > Well, think of this from the perspective of Linux users. They don't
>> > get to configure seperately, so only Windows users get special
>> > treatment here (and maybe Mac too, since it's using Qt). Basically, if
>> > two configures are necessary, you simply just hit the "generate"
>> > button twice, and the wait may be slightly longer because of the
>> > generation. However, usually it's the configure step that takes 99% of
>> > the time and generation is quick since it's just spitting out files to
>> > disk it seems.
>> >
>> > I would also argue that any CMake project should have appropriate
>> > defaults OR logic to calculate the defaults for you, so that even if a
>> > user decides to not modify any cache variables, generation should
>> > always succeed. CMake can't assume that 2 passes will be necessary
>> > (and it really shouldn't).
>>
>> Oh and also, if two configures are necessary (say that, a library or
>> package can't be found intelligently), then the configuration step
>> would fail and be interrupted, so you get a chance to correct any
>> errors and adjust appropriate cache variables. So, in this case it
>> doesn't really matter if you've hit configure or generate.
>> --
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>
>
>
> Iterative configuring through the gui is useful for some people/projects,
> and generating is time-consuming too on some larger projects with some
> generators.
>
> So we probably won't be eliminating the Configure button anytime soon. On
> the other hand, you can just click "Generate" if that's what you want and
> ignore the configure button altogether nowadays. "Generate" will
> configure-first if necessary, and then generate.
>
> Here are some related issues indicating some people want the exact opposite
> (i.e., separate configure and generate steps for the command line cmake)
>   http://public.kitware.com/Bug/view.php?id=13359
>
> And a request for a "build" button in cmake-gui:
>   http://public.kitware.com/Bug/view.php?id=8260

I definitely hear your point, and I realize not everyone has my
specific workflow, but usually I only hit configure to see if there
are any failures that do NOT stop the generation process (such as
status messages that print in red, but do not indicate an actual
error). In that case, I do not want generation to proceed but instead
I want to address the alert / error in the logs. However, if
configuration succeeds I only end up hitting generate right after that
anyway.

I am only bringing this up since I was surprised to see how my team
struggled to understand the differences between the two, and when to
use one or the other. Most of the time I just say "Ignore the
configure button, just always hit generate". If it wasn't there, it
would be more clear to people that are new to CMake. I'm trying to
migrate my company to CMake, so I thought this might be valuable
feedback, as it was one of the surprising little things we got hung up
on that you just never really think about.


More information about the CMake mailing list