someclass.h, someclass_alternative.cpp and auto moc

René J.V. Bertin rjvbertin at gmail.com
Mon Oct 9 23:56:54 UTC 2017


Hi,

Apologies for asking something that should probably be evident (I can't come up with a specific enough google search term).

I'm still polishing my QTextBrowser implementation for StandardDocumentationView and thought it would be cleaner if I put it in a dedicated implementation file standarddocumentation_qtb.cpp. Evidently I need to keep the standarddocumentationview.h headerfile. Then in the CMake file I'd do

if(KDEVELOP_USE_QTEXTBROWSER)
    set(KDevPlatformDocumentation_LIB_SRCS
        standarddocumentationview_qtb.cpp)
else()
    set(KDevPlatformDocumentation_LIB_SRCS
        standarddocumentationview.cpp)
endif()
set(KDevPlatformDocumentation_LIB_SRCS ${KDevPlatformDocumentation_LIB_SRCS}
    documentationfindwidget.cpp
    documentationview.cpp
)


Sadly I get a number of link errors that show that something goes wrong with the moc file, unless I keep standarddocumentationview.cpp included with all code #ifdef'ed out and just a moc file include.

That's better than nothing but is there no more elegant way to do what I'm trying to do here?

Thanks,
René


More information about the KDevelop-devel mailing list