Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Building apps from command line
Forum Updated to NodeBB v4.3 + New Features

Building apps from command line

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 862 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.
  • E Offline
    E Offline
    Emil Kaczmarek
    wrote on last edited by
    #1

    Hi guys,

    Seems a strange problem, to which I have failed to found a solution yet.
    I need to have certain lines in my pro file to execute only when the app is run from within the Qt Creator and I want them to be ignored if qmake is executed from command line. If that is possible I would certainly welcome a solution. Tried to search if Qt Creator defines something which can be detected from within the pro application file and then those lines of mine would be executed as I want. Currently if I qmake and make the app from command line I need to comment those lines temporarily.

    jsulmJ 1 Reply Last reply
    0
    • E Emil Kaczmarek

      Hi guys,

      Seems a strange problem, to which I have failed to found a solution yet.
      I need to have certain lines in my pro file to execute only when the app is run from within the Qt Creator and I want them to be ignored if qmake is executed from command line. If that is possible I would certainly welcome a solution. Tried to search if Qt Creator defines something which can be detected from within the pro application file and then those lines of mine would be executed as I want. Currently if I qmake and make the app from command line I need to comment those lines temporarily.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Emil-Kaczmarek You can use environment variables for that.
      "To obtain the contents of an environment value when qmake is run, use the $$(...) operator:" , see http://doc.qt.io/qt-5/qmake-language.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • E Offline
        E Offline
        Emil Kaczmarek
        wrote on last edited by
        #3

        That was the problem, I used $$ without brackets. However, qmake function equals does not seem to be capable of comparing two environment variables, namely:

        equals($$(OUT_PWD), $$(PWD)) {
        message("PATHS ARE EQUAL")
        }

        Does not work as expected. It should execute when pro file is run from command line.

        1 Reply Last reply
        0
        • E Offline
          E Offline
          Emil Kaczmarek
          wrote on last edited by
          #4

          OK,

          finally solved by

          PATH1 = $$OUT_PWD
          PATH2 = $$PWD

          !equals(PATH1, $$PATH2) {

          1 Reply Last reply
          1

          • Login

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