Disable qmake moc rules and create own rules



  • Hi!

    i am trying to import a opensource library in our build. The library is normally build with cmake, i have to use qmake.
    So i made a profile, adding headers and sources. Everything is ok, but...

    The source file in the projects have class definitions in source files and include the generated moc files in the source, e.g.

    in a.cpp at the end of file: #include "a.moc".

    So i have now 2 major problems:

    1. a.moc is not found, cause qmake normally generates moc_a.cpp files
    2. moc_a.cpp files are automatically compiled and linked The generated moc_a.cpp files wont compile, cause the class definition is not available

    So i have tried many things:

    a) customize moc step to produce a.moc files: gives errors due to double defined symbols cause they are automatically linked and included in the source files
    b) try to disable moc with qmake -nomoc, remove moc compilers with QMAKE_EXTRA_TARGETS -= moc_headers etc, no success
    b) overwrite the moc rules with my personal rules.

    What i want to do:

    • disable the moc processing of qmake
    • write my custom compiler for moc

    And this is the solution i found:

    I added a custom features directory, copied the original moc files from mkspecs/features/moc.prf, modified it to my needs and then it worked.
    Can anybody give me a hint for a simpler solution?


Log in to reply
 

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