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. Declaring bin and build directories

Declaring bin and build directories

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 890 Views
  • 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.
  • M Offline
    M Offline
    mellow
    wrote on last edited by
    #1

    I have a project with subdirs app, src and tests. When I compile the project, I would like for the executable to go to bin subdirectory and all the object and moc files to go to build subdirectory. How do I do this? I would like it to work so that if I clone the project to another computer, it will automatically compile to these directories without having to change any settings.

    I have also another question. When I hit run in qt creator, it only runs the tests. Can I somehow make it run the tests and the app?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You can specify various output paths in the .pro file, for example:

      DESTDIR = ../bin
      MOC_DIR = ../build
      RCC_DIR = ../build
      UI_DIR = ../build
      OBJECTS_DIR = ../build
      
      M 1 Reply Last reply
      1
      • Chris KawaC Chris Kawa

        You can specify various output paths in the .pro file, for example:

        DESTDIR = ../bin
        MOC_DIR = ../build
        RCC_DIR = ../build
        UI_DIR = ../build
        OBJECTS_DIR = ../build
        
        M Offline
        M Offline
        mellow
        wrote on last edited by
        #3

        @Chris-Kawa Yes that's it thank you. Now how would I specify different build folders for release and debug? I.e. build/release and build/debug.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by Chris Kawa
          #4

          One way to do this:

          CONFIG(debug, debug|release) {
              MYVARIABLE= debug
          }
          CONFIG(release, debug|release) {
              MYVARIABLE= release
          }
          
          DESTDIR = ../bin/$$MYVARIABLE
          MOC_DIR = ../build/$$MYVARIABLE
          ...
          
          1 Reply Last reply
          1
          • M Offline
            M Offline
            mellow
            wrote on last edited by
            #5

            Thank you!

            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