Configure build directory dialog explained

Mateusz Łoskot mateusz at loskot.net
Sat Oct 29 19:15:03 BST 2011


On 29 October 2011 11:28, Andreas Pakulat <apaku at gmx.de> wrote:
> On 29.10.11 01:14:38, Mateusz Łoskot wrote:
>> I do this:
>> 1) New session created.
>> 2) Open / Import Project.
>> 3) Configure a build directory
>> (http://www.flickr.com/photos/mloskot/6290341650/)
>>
>> Question 1)
>> Build type, is it reconfigurable once the project is created/imported?
>
> Yes and no. You can re-configure it, but that'll require deleting and
> re-creating the build directory since CMake does not support changing
> the Buildtype in an existing build-tree.

Yes, makes perfect sense.

>> Or, the project is supposed to be set with particular build type once
>> and for good
>> and if user wants to change the build type later, then she is supposed to
>> create/import new project?
>
> You could simply add another build directory in the project
> configuration and switch between the two.

Understood.
I assume you mean the following procedure:
1) Project > Open Configuration > "Configure CMake settings" panel
2) Green plus on the right of the combo box with currently configured
build directory
3) Configure a build directory
4) Check if CMAKE_BUILD_TYPE is set accordingly

Then to switch between build types, do step 1) and select build
directory from the combo.

I have tried this procedure and it seems to work.

A few comments came to my mind:
1) Build directory combo box in "Configure CMake settings" panel is
not labelled,
    so it's may be confusing what is this.
2) IMHO, "Configure CMake settings" could be more user-friendly if:
- has combo box labelled "Build type" what would correspond with
setting put in new/import project configuration dialog
- below this "Build type" is field with corresponding build directory
- selection of "Build type" in combo box, updates the field with the
build directory as it does with variables in "Cached Values" panel
- this would make process of configuration update more logical, IMHO.

>> Question 2)
>> What exactly is the kosher input in Extra Arguments?
>
> A string passed as arguments to the cmake invocation. So anything you
> can pass to cmake on the commandline you can put in here too.

OK, nice.

> What I'm
> not sure about right now is wether it properly supports spaces in
> argument-values or simply does a str.split(" ") to get a list of
> arguments from it.

Understood.

>> Question 3)
>> If Debug is selected as Build type and Extra Arguments is given with
>> -DCMAKE_BUILD_TYPE=Release, which one has preference?
>
> Thats something to look up in the cmake manual or the cmake mailinglist.

IMO, it is KDevelop thing, not CMake.
Under the hood, selection of "Build type" generates -DCMAKE_BUILD_TYPE="..."
for CMake arguments:

https://projects.kde.org/projects/extragear/kdevelop/kdevelop/repository/revisions/master/entry/projectbuilders/cmakebuilder/cmakejob.cpp#L155

So, if user selects Debug from "Build type" and in Extra Arguments
puts -DCMAKE_BUILD_TYPE="Release"

I assume cmake tool might be call as
cmake -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_BUILD_TYPE="Release" ...

Quick command line experiment shows the last occurance will be used:

$ cmake -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_BUILD_TYPE="Release" ../liblas
-- Setting libLAS build type - Release
$ cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_BUILD_TYPE="Debug" ../liblas
-- Setting libLAS build type - Debug

So, now we know what is the preferrence.
However, KDevelop could check the "args" content and stick to what's
selected in "Build type" combo,
for sake of consistency and predictability.

>> Question 4)
>> If the installation prefix is left empty, does it mean default
>> CMAKE_INSTALL_PREFIX value is used?
>
> If you leave it empty, cmake will choose one - which is /usr/local on
> Linux as documented in the cmake manual.

Sure, just wanted to confirm.


Thanks very much for the clarifications.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org




More information about the KDevelop mailing list