1
votes

I have a script used for CI builds that adds a CONFIG variable to qmake when building via Linux. I need to do the same for Windows desktop devs from within QtCreator. This needs to be an optional (every now and then) thing, rather than the default. Hence why it is not in the .pro file permanently.

Is this possible? And if so, how do I do it?

Edit:

Example of my situation is:

base.pro

 SUBDIRS = common base

 DESKTOP {
  SUBDIRS += app
 }

 CI {
  SUBDIRS += app support_tools
 }

Build Script:

 #!/bin/bash
 qmake -makefile -r -Wall CONFIG+=CI
 make

So what I'd like to be able to do is to (occasionally) do the CI style build from within QtCreator. In other words, I just need to be able to pass the additional CONFIG entry to qmake.

Yes, the users could edit the pro file, but that's annoying and has the chance of getting mistakenly committed. It doesn't seem like much of an ask to be able to pass something to qmake from Creator, but I couldn't see where.

1
In the .pro file, you can use condition to add your optional thing. What is your condition ? - thibsc
I have an entry in the base .pro file, that lists different subdirs per target type. Part of the way the target is defined is based on a CONFIG entry. This entry is passed by a script in the CI build. However this same ability would be useful to have within Creator occasionally. So I wanted to be able to pass a parameter to QMake from within Creator. - Joe
Can you provide a full exemple of what do you want in Linux and windows ? I'm not sure to really understand - thibsc

1 Answers

2
votes

You do that in the build settings of the project. You just add CONFIG+=CI in the qmake build step (click the "Details" button to expand it). Once you're done with testing, just remove it again. Or you can create a dedicated CI build configuration that always adds CONFIG+=CI. Although in your case, you probably just want to temporarily add that, build, and then remove it again.