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. Place generated moc files into subfolders

Place generated moc files into subfolders

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 755 Views 2 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.
  • P Offline
    P Offline
    Patrick Wright
    wrote on last edited by
    #1

    I have a Qt project divided into subfolders using .pri files.

    For example, I use the following structure

    project/
    |_project.pro
    |_include/
        |_foo/
            |_foo.pri
            |_file1.h
        |_bar/
            |_bar.pri
            |_file2.h
    |_src/
        |_foo/
                |_foo.pri
                |_file1.cpp
            |_bar/
                |_bar.pri
                |_file2.cpp
    

    I am then using the

    CONFIG += object_parallel_to_source
    

    option in my .pro file to generate the .o files in their respective directories. The reason I do this is because files in different directories may have the same names (and may contain classes with the same names BUT in different namespaces).

    However, when the moc runs on this project, it places all of the moc_*.cpp files in the same directory. This causes a problem in the case I mentioned above where files have the same name.

    Is there a way to make qmake/moc generate the moc source files into the appropriate subdirectories just like the object files?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      MOC_DIR https://doc.qt.io/qt-5/qmake-variable-reference.html#moc-dir

      (Z(:^

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved