Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Detect if Qt project is parsed from Qt Creator or command line?
Qt 6.12 LTS is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JonasAH
    wrote on last edited by
    #1

    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').

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        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")
        }
        @

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            My guess is laziness :-D

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JonasAH
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt
              • Unsolved