[CMake] dependlocal problem
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Feb 22 20:14:58 EST 2005
Hi,
I'm trying to build kdevelop with cmake and wrote some new macros. Now I
see the following: when starting make in the kdevelop root directory, it
traverses and builds as expected, but it seems for dependlocal it starts
make for every file. Is this expected behaviour ?
The result you see below, this takes quite long (more than 1 minute just
the dependlocal) on a fast machine (2GHz).
make[7]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
Building dependencies. cmake.depends...
/usr/local/bin/cmake -S/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor -O/home/src/kde3-HEAD/
kdevelop_3_3_branch/tmo/kdevelop/lib/widgets/propeditor -H/home/src/
kde3-HEAD/kdevelop_3_3_branch/tmo/kdevelop -B/home/src/kde3-HEAD/
kdevelop_3_3_branch/tmo/kdevelop
make[7]: Leaving directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make cmake.check_depends
make[7]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make[7]: `cmake.check_depends' is up to date.
make[7]: Leaving directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make -f cmake.check_depends
make[7]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make[8]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make[9]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
Building dependencies dependlocal...
make[9]: Leaving directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make[9]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
Building dependencies dependlocal...
make[9]: Leaving directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make[9]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
Building dependencies dependlocal...
make[9]: Leaving directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make[9]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
Building dependencies dependlocal...
make[9]: Leaving directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
make[9]: Entering directory `/home/src/kde3-HEAD/kdevelop_3_3_branch/tmo/
kdevelop/lib/widgets/propeditor'
Building dependencies dependlocal...
This seems to be the macro which causes this effect:
#check every file for "include <blah.moc> and if so, creates the rules
#for the moc file
MACRO(KDE_AUTOMOC)
SET(_matching_FILES )
FOREACH (_current_FILE ${ARGN})
IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE})
GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
SET(_moc ${_basename}.moc)
FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} _contents)
STRING(REGEX MATCH "#include.+${_moc}" _match "${_contents}")
IF(_match)
SET(_moc_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
ADD_CUSTOM_COMMAND(OUTPUT ${_moc_FILE}
COMMAND moc
ARGS ${_header} -o ${_moc_FILE}
DEPENDS ${_header}
)
ADD_FILE_DEPENDANCY(${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}
${_moc_FILE})
ENDIF(_match)
ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE})
ENDFOREACH (_current_FILE)
ENDMACRO(KDE_AUTOMOC)
MACRO(ADD_FILE_DEPENDANCY file)
SET(${file}_deps ${${file}_deps} ${ARGN})
SET_SOURCE_FILES_PROPERTIES(
${file}
PROPERTIES
OBJECT_DEPENDS
"${${file}_deps}"
)
ENDMACRO(ADD_FILE_DEPENDANCY)
I use it this way:
SET(kdevpropertyeditor_SRCS
childproperty.cpp
pcombobox.cpp
pdummywidget.cpp
ppointedit.cpp
propertymachinefactory.cpp
pstringlistedit.cpp
multiproperty.cpp
pcursoredit.cpp
pfontbutton.cpp
prectedit.cpp
propertywidget.cpp
psymbolcombo.cpp
...more files
)
KDE_AUTOMOC(${kdevpropertyeditor_SRCS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
ADD_LIBRARY(kdevpropertyeditor SHARED ${kdevpropertyeditor_SRCS})
The ADD_CUSTOM_COMMAND() seems to be the command which cause this strange
behaviour. Any ideas what's going on there or how I can find out ?
I'm using cmake cvs from some weeks ago.
Bye
Alex
--
DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl
More information about the CMake
mailing list