1

I'm trying to set the OUT_PWD parameter when using Qt Creator. The documentation say's NOT to overwrite this parameter. So, is there another safe way to change this parameter in the .pro file?

The reason I want to modify this directory is to maintain a uniform workspace across all of my developers. At the moment when a person opens a new project, they need to ensure the "build directory" is set correctly in the "project" tab. I'd like to make this a parameter that is set in the .pro file so that all developers are working in the same directory structure.

This is important as I have both Apps and Libs combined in a SUBDIRS type of project and need to ensure the Libs end up in the right place.

Thanks for any help you can provide.

Stanton
  • 904
  • 10
  • 25

2 Answers2

2

This makes zero sense, because the build folder is meant to be arbitrary, and you're meant to have possibly a multitude of build folders for any given project - depending on how you build the project.

I think that your workflow is broken, and the fix is to the workflow itself, not to project files.

This is important as I have both Apps and Libs combined in a SUBDIRS type of project and need to ensure the Libs end up in the right place.

That's done by adding targets that put the executables/libraries where you want them, not by modifying OUT_PWD.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
  • I don't agree that it makes zero sense. Actually, I'm using SUBDIRS and OUT_PWD for plugins that are needed to be loaded next to the exe easily. Like `CONFIG(release, debug|release) { LIBS += -L$$OUT_PWD/../../core/release -lmiam-core }` for Windows build. So when I press build, everything is compiling and I do not need to add extra targets (which are saved in *.pro.user file, not *.pro) – MBach Jan 10 '17 at 19:20
  • I'm talking about the targets within your `.pro` file, these targets should be built without you having to explicitly pass them to make. – Kuba hasn't forgotten Monica Jan 10 '17 at 19:56
  • Combining your answer and @Stanton's, adding the following line to `.pro` file worked for me to **put only the executable file** in my desired directory (which is inside source dir): `debug:DESTDIR = $$PWD/build`. – today Oct 29 '18 at 23:58
1

The solution I used was the following.

Debug:DESTDIR = $$PWD/debug
Debug:OBJECTS_DIR = $$PWD/debug/.obj
Debug:MOC_DIR = $$PWD/debug/.moc
Debug:RCC_DIR = $$PWD/debug/.rcc
Debug:UI_DIR = $$PWD/debug/.ui

Release:DESTDIR = $$PWD/release
Release:OBJECTS_DIR = $$PWD/release/.obj
Release:MOC_DIR = $$PWD/release/.moc
Release:RCC_DIR = $$PWD/release/.rcc
Release:UI_DIR = $$PWD/release/.ui

The build directory is still placed in whatever location is specified by the .pro.user file (which is not something I was concerned with), but at least the lib files are placed in a known location relative to the .pro file and will therefore be uniform across my developers.

I found part of the solution at this link (How to specify different Debug/Release output directories in QMake .pro file), but the main difference is the addition of $$PWD/ to the beginning of the path

Community
  • 1
  • 1
Stanton
  • 904
  • 10
  • 25