Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Declaring bin and build directories

    General and Desktop
    2
    5
    621
    Loading More Posts
    • 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
      mellow last edited by

      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 Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        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 Reply Quote 1
        • M
          mellow @Chris Kawa last edited by

          @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 Reply Quote 0
          • Chris Kawa
            Chris Kawa Moderators last edited by Chris Kawa

            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 Reply Quote 1
            • M
              mellow last edited by

              Thank you!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post