[SOLVED] Detect if Qt project is parsed from Qt Creator or command line?



  • In our project we specify compilation mode (debug/release) in the project file. This works fine when compiling from command line, but when compiling in Qt Creator I would like to use debug and release as configured in Qt Creator. Is there any way to detect if the project is parsed from Qt Creator?

    Or is there another way to tackle this problem? We want to avoid having to provide arguments to qmake (i.e. 'qmake CONFIG+=debug').



  • Solution is not in the .pro because qmake generate it.



  • Ok, I will just ignore that you don't want to have extra arguments to qmake and assume that you mean the call from commandline.

    If you provide Additional arguments in the project configuration inside QtCreator, e.g.

    @
    CONFIG+=qtcreator
    @

    you can have different execution paths of your .PRO file:

    @
    CONFIG(qtcreator){
    message("with qtcreator")
    }
    else{

    do the commandline stuff here

    message("we are on the commandline")
    }
    @


  • Moderators

    Why do you specify compilation mode in the .pro-file? What is the use case for doing that?



  • My guess is laziness :-D



  • It was a probably a carry-over when we converted our Makefile based project to Qt. We decided to get rid of it, so this is not an issue now.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.