Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set source directory in qmake?

How to set source directory in qmake?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 2.0k 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.
  • K Offline
    K Offline
    kitfox
    wrote on last edited by
    #1

    I'm tryi8ng to clean up my project a bit and would like to move all the source files to be under a directory called src/ so they don't get mixed with any files the build process geenrates. Is there a way to tell qmake to look for my files there?

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Yes, put src/ in front of all concerned file paths in your .pro file.

      Note that if you use an out of source build, you don't have to worry about that.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Yes, put src/ in front of all concerned file paths in your .pro file.

        Note that if you use an out of source build, you don't have to worry about that.

        K Offline
        K Offline
        kitfox
        wrote on last edited by
        #3

        @SGaist What's an out of source build?

        aha_1980A 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          As the name suggests: a build that happens out of your application source tree.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • K kitfox

            @SGaist What's an out of source build?

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @kitfox said in How to set source directory in qmake?:

            @SGaist What's an out of source build?

            Sometimes it's called "shadow build": Creator uses them by default.

            • https://doc.qt.io/qtcreator/creator-build-settings.html
            • https://doc.qt.io/qtcreator/creator-glossary.html#glossary-shadow-build

            Qt has to stay free or it will die.

            1 Reply Last reply
            1
            • Cobra91151C Offline
              Cobra91151C Offline
              Cobra91151
              wrote on last edited by
              #6

              @kitfox

              Hi! You can add these commands to your .pro file:

              MOC_DIR = ./src/moc
              OBJECTS_DIR = ./src/objects
              RCC_DIR = ./src/resource
              

              It will clean up your application build directory and store all the moc, objects, resources files in the src directory.

              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