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. QtCreator. Pro file. Target file path relative to the *.pro file path.
Forum Updated to NodeBB v4.3 + New Features

QtCreator. Pro file. Target file path relative to the *.pro file path.

Scheduled Pinned Locked Moved Qt Creator and other tools
8 Posts 2 Posters 13.2k 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.
  • _ Offline
    _ Offline
    _Dima
    wrote on last edited by
    #1

    Can I set in the *.pro file the specific target file path relative to the *.pro file path and independent of the build directory? And Can I get in this target directory only executable file and no any *.ilk, *.pdb and other intermediate files?

    There is some "DESTDIR ":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#destdir parameter:
    "Specifies where to put the target file."

    So I've created file "myProject/myProject.pro" which includes "DESTDIR = bin", opened "myProject.pro" in the QtCreator, set "build directories" as "myProject/Debug" and "myProject/Release", build project....

    And I expected that myProject.exe (target file, one file, not files) was created as myProject/bin/myProject.exe.

    But QtCreator has build exe file as myProject/Debug/bin/myProject.exe (it relatives to the build directory) and put to this dest directory a lot of intermediate files (*.ilk, *.pdb and etc.)

    myProject/myProject.pro:
    @
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = myProject
    DESTDIR = bin
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui
    @

    And I

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Turn off shadow building in Qt Creator, or run qmake from the command line.

      (Z(:^

      1 Reply Last reply
      0
      • _ Offline
        _ Offline
        _Dima
        wrote on last edited by
        #3

        [quote author="sierdzio" date="1395836448"]Turn off shadow building in Qt Creator, or run qmake from the command line.[/quote]
        It looks good! The executable file is placed in the needed directory.
        But what is about intermediate files (*.ilk, *.pdb, *.manifest, *.rc and etc.)? Can I replaced them to build directory?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Of course!

          See how I usually do it ("source":https://github.com/sierdzio/spdr/blob/master/definitions.pri):
          @
          BUILDDIR = $$PWD/build

          OBJECTS_DIR = $${BUILDDIR}
          MOC_DIR = $${BUILDDIR}
          RCC_DIR = $${BUILDDIR}
          UI_DIR = $${BUILDDIR}
          @

          This will put pretty much everything in build directory.

          Things that will still be put elsewhere:

          • Makefile generated by qmake (can be changed by specifying the Makefile path by hand, IIRC the variable was QMAKE_MAKEFILE)
          • some Android-specific files (if you are building for android)

          (Z(:^

          1 Reply Last reply
          0
          • _ Offline
            _ Offline
            _Dima
            wrote on last edited by
            #5

            An one more question - how to turn off shadow building in the *.pro file?

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              [quote author="_Dima" date="1395837256"]An one more question - how to turn off shadow building in the *.pro file?[/quote]

              Sadly, I have no answer here... I would love to be able to do it myself, but I don't know how.

              I think I saw somebody mention that you can achieve this by using a .pro.share file, but I have not tried this.

              What you can do is to turn off shadow building globally in Qt Creator: go to settings, Build & Run and set this as the Default build directory: . (just a dot :)).

              (Z(:^

              1 Reply Last reply
              0
              • _ Offline
                _ Offline
                _Dima
                wrote on last edited by
                #7

                [quote author="sierdzio" date="1395837432"][quote author="_Dima" date="1395837256"]An one more question - how to turn off shadow building in the *.pro file?[/quote]

                Sadly, I have no answer here... I would love to be able to do it myself, but I don't know how.

                I think I saw somebody mention that you can achieve this by using a .pro.share file, but I have not tried this.

                What you can do is to turn off shadow building globally in Qt Creator: go to settings, Build & Run and set this as the Default build directory: . (just a dot :)).[/quote]

                Thank for your help!

                I have to keep all project settings only in the pro file (or in the some additional config files). This file (pro) is placed in the source control system and many programmers use it. I cannot force them to set any project settings (specific build directory, shadow build and etc.) in the QtCreator.

                Good solution is setting of all parameters in the *.pro file.

                1 Reply Last reply
                0
                • _ Offline
                  _ Offline
                  _Dima
                  wrote on last edited by
                  #8

                  Sorry I cannot get PWD to work...

                  Could you please advise how to copy only target file (myProject.exe) from the build directory to the specific directory after linking?

                  For example using of the QMAKE_POST_LINK.

                  I means something like this:
                  @
                  BUILDDIR = $${DESTDIR}
                  QMAKE_POST_LINK +=$$quote(cmd /c copy /y $${BUILDDIR}$${FILE} ../$${FILE})
                  @

                  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 Extensions
                  • Unsolved