[Qbs] Is there a feature similar with cmake option?

Christian Gagneraud chgans at gmail.com
Sat Jul 6 04:31:35 CEST 2019

On Sat, 6 Jul 2019 at 02:49, Vincent Hui <vincenthk007 at gmail.com> wrote:
> Hi Richard,
> Thank you for your reply,
> Sorry, I am not a cmake expert. I cannot explain what CMakeCache.txt is used for. What I can tell is that cmake users either edit CMakeCache.txt directly to change values of options or use CMake GUI to build a project in interactive mode, I am thinking whether we need qbs GUI in order to  let users build a project in interactive mode.

This CMakeCache.txt can be problematic, sometimes with CMake if you
want to reconfigure your project you need to wipe out this file and
sometimes the whole build directory. AFAIU, this is similar to qmake
stash and the so-called "site" files of GNU autotools.

> Why GUI is needed to let users build projects in interactive mode in cmake.
> " Using CMake to build a project in non-interactive mode is a simple process if the project does not have many options. For larger projects like VTK, using ccmake, cmake -i, or CMakeSetup is recommended. This is because as you change options in the CMakeCache.txt file, cmake may add new entries to that file. It can be difficult to know when to stop the run cmake, edit the cache file cycle without the aid of an interface."
> https://cmake.org/runningcmake/

Having to re-run cmake all the time is a real pain, and user
experience with qtcreator goes down big time when you have a big
project as it introduce minute long delay and freeze the UI for 5 to
10 seconds.
As well soemetimes qtcreator get stuck, and you have to re-run cmake
"manually" (hitting ctrl-B doesn't work anymore).
But it sometimes get even worth, there are situation where you need to
close/reopen your project, and unfortunately you sometimes need to
*restart* qtc, due to cmake work dir being completely broken.
All of the above happens when you edit various part of your cmake
files, which is often the case of a project maintainer that tries to
add new features to a project.
I'm quite frustated with that, but i'm patient and hope this will
improve over time.

Initially i didn't like this GUI thing, but latter learned to
appreciate its value, for example QtCreator gives you access to all
these options in the project's build settings, and use the right
widget for the "option" editor.
It is very valuable because as a project maintainer it allows you to
make it easy for other developers to play with these options.
You can define the type of the options (limited set: bool, file, dir
and strings), default value, and a help string.

These options don't belong to profiles as they are project specific.

Having a way to expose project specific options with qbs would be a nice thing.


More information about the Qbs mailing list