QtCreator solution (SUBDIRS project): how to take control over the child projects' build dir path



  • Hello all. The problem: there is a SUBDIRS project that is referring to several ordinary qmake project files. A shadow build is being used. Let's have the following directory and project structure:

    listing #1
    ----------
    [work_projects]
      [solution-Desktop-Qt5.<x>-MSVC20<yy>-(Debug|Release)]
        [project1]
        [project2]
        ...
        [project<N>]
      
      [solution]
        solution.pro
        [project1]
          project1.pro
        [project2]
          project2.pro
        ...
        [project<N>]
          project<N>.pro
    

    If the solution file is positioned in the parent directory of the child projects then qmake creates the correct build directory structure - the build folder of the whole solution fully replicates the directory structure of the sources and is situated at the same directory level as the directory containing the solution's SUBDIRS .pro file. This is the correct scenario. Also noticed that if the solution project file is moved in an indirect parent directory relative to the projects' ones, the relative directory path starting from the solution's directory to the direct projects' parent directory is reflected in the shadow build folder structure:

    listing #2
    ----------
    [work_projects]
      [solution-Desktop-Qt5.<x>-MSVC20<yy>-(Debug|Release)]
        [intermediate_container_dir]
          [project1]
          [project2]
          ...
          [project<N>]
    
      [solution]
        solution.pro
        [intermediate_container_dir]
          [project1]
            project1.pro
          [project2]
            project2.pro
          ...
          [project<N>]
            project<N>.pro
    

    Thus, obviosly Qt Creator/qmake expects the solution project to be situated in the direct parent directory, so that to produce the simplest shadow build directory structure:

    listing #3
    ----------
    
    [build-solution-...]
      [project1]
        [Debug]
        [Release]
      [project2]
        [Debug]
        [Release]
    
      ...
      
    [project<N>]
        [Debug]
        [Release]
    

    The third scenario, which I am interested at and which produces unexpected (but probably correct if it works as designed) results is the following one:

    listing #4
    ----------
    
    [work_projects]
      [solution-Desktop-Qt5.<x>-MSVC20<yy>-(Debug|Release)]
      [solution]
        solution.pro
      [projects]
        [project1]
          [Debug]
          [Release]
          Makefile
          Makefile.Debug
          Makefile.Release
          project1.pro
      
        [project2]
          [Debug]
          [Release]
          Makefile
          Makefile.Debug
          Makefile.Release
          project2.pro
      
        ...
      
        [project<N>]
          [Debug]
          [Release]
          Makefile
          Makefile.Debug
          Makefile.Release
          project<N>.pro
    

    Here, the solution file is not positioned in a directory that is either a direct or indirect parent, but in a side branch of the folders tree. Having this project and folder organization and building the project resulted in a shadow build for the solution project but in a non-shadow build for the controlled ordinary projects despite "Shadow build" is turned on for the whole solution. Thus all build releated files and folders (Debug, Release, Makefiles, etc.) were generated inside each ordinary project's source directory.

    The question: Any guesses how to achieve the most simple shadow build directory structure shown above (listing #3) no matter the position of the solution project file?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.