kdewidgets designer plugin not built correctly

Alexander Neundorf neundorf at kde.org
Fri Apr 7 22:23:20 CEST 2006


On Friday 07 April 2006 21:00, Alexander Neundorf wrote:
> On Friday 07 April 2006 15:52, Matt Rogers wrote:
> > Hi,
> >
> > the kdewidgets.so library that hold all the kde widget plugins for use
> > in designer is not being built correctly. There are several issues:
> >
> > 1. kdewidgets.cpp is not regenerated if makekdewidgets has to be rebuilt
> > due to a change in the code or after a 'make clean' in the kdewidgets
> > directory.
> >
> > 2. kdewidgets.so does not contain the symbols from kdewidgets.o that is
> > built from kdewidgets.cpp (at least that's what i see when looking at
> > the output of nm)
> >
> > 3. kdewidgets.la is not recreated during the build process after a 'make
> > clean'. doing a 'make clean && make && make install' results in an error
> > from cmake about kdewidgets.la not being found.
> >
> > AFAICT, the CMakeLists.txt file in kdelibs/kdewidgets looks fine but
> > perhaps somebody else could take a look.
>
> This is from the CMakeLists.txt:
>
> add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp
>   COMMAND "${MAKEKDEWIDGETS_EXECUTABLE}"
>   ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp
> ${CMAKE_CURRENT_SOURCE_DIR}/kde.widgets
>   DEPENDS kde.widgets makekdewidgets)
>
> set(kdewidgets_PART_SRCS
>    classpreviews.cpp
>    ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp
> )
>
> qt4_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp
> ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.moc)
>
> kde4_automoc(classpreviews.cpp)
>
> qt4_add_resources(kdewidgets_PART_SRCS kdewidgets.qrc)
>
> kde4_add_plugin(kdewidgets ${kdewidgets_PART_SRCS})
>
> Which looks ok, but apparently cmake seems to "forget" about
> kdewidgets.cpp, here's a snippet from the link command:
>
> -o ../lib/kdewidgets.so "CMakeFiles/kdewidgets.dir/classpreviews.o"
> "CMakeFiles/kdewidgets.dir/qrc_kdewidgets.o"
> -L/home/alex/src/kde4-svn/kdelibs-build/lib
>
> IOW no kdewidgets.o is linked. kdewidgets_PART_SRCS still contains
> kdewidgets.cpp, and cmake complains without the add_custom_command().
> Replacing kde4_add_plugin() with add_library() doesn't change this
> behaviour. Bug in cmake ?

Ok, I figured it out with Bill.
It's not a bug, it's a feature :-)
Maybe a slightly obscure one though.

If in a ADD_CUSTOM_COMMAND() "MAIN_DEPENDENCY foo" is used instead of DEPENDS, 
this means for cmake that the file "foo" is processed by this command and 
nothing else, i.e. that this command "compiles" this file. So if 
MAIN_DEPENDENCY is used with a source file, the source file won't be compiled 
as it should. Replacing MAIN_DEPENDENCY with DEPENDS fixes this.
But DEPENDS has some side effects e.g. in MSVC, so if the MAIN_DEP file is no 
source file (but e.g. a header or a ui file or a kcfg file), using 
MAIN_DEPENDENCY is better than DEPENDS.

I'm testing it right now here, if nothing breaks, I'll commit.

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list