[SOLVED] Re: cmake 2.4.* does not create moc files in kdepimlibs
Friedrich W. H. Kossebau
Friedrich.W.H at kossebau.de
Sun Aug 13 12:10:10 CEST 2006
Am Sonntag, 13. August 2006 04:06, schrieb William A. Hoffman:
> At 05:11 PM 8/12/2006, Friedrich W. H. Kossebau wrote:
> >The passing of 1 as a variable to the macro "macro_bool_to_01" was the
> >culprit. CMakeLists.txt in kdepimlibs contained
> > macro_bool_to_01(LDAP_FOUND HAVE_LDAP 1)
> >and
> > macro_bool_to_01(SASL2_FOUND HAVE_SASL2 1)
> >
> >Removing the 1 made sense and gave me a working build again, hurra
> >Just don't ask how many hours were spend :/
> >
> >Bill, perhaps cmake should detect such wrong variables in further
> > versions?
>
> I am still not exactly sure what went wrong. What is macro_bool_to_01,
$ cat kdelibs/cmake/modules/MacroBoolTo01.cmake
# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN )
# This macro evaluates its first argument
# and sets all the given vaiables either to 0 or 1
# depending on the value of the first one
MACRO(MACRO_BOOL_TO_01 FOUND_VAR )
FOREACH (_current_VAR ${ARGN})
IF(${FOUND_VAR})
SET(${_current_VAR} 1)
ELSE(${FOUND_VAR})
SET(${_current_VAR} 0)
ENDIF(${FOUND_VAR})
ENDFOREACH(_current_VAR)
ENDMACRO(MACRO_BOOL_TO_01)
> and what 1 did you remove?
The last parameter in these "calls" to the macro (whyever they were there):
macro_bool_to_01(LDAP_FOUND HAVE_LDAP 1)
macro_bool_to_01(SASL2_FOUND HAVE_SASL2 1)
> And what did any of this have to do with moc?
:) In KDE4Macros.cmake the creation of rules for the creation of moc files
(KDE4_AUTOMOC) is guarded with
if (EXISTS ${_abs_FILE} AND NOT _skip)
The passing of 1 as variable to the macro MACRO_BOOL_TO_01 causes later here
the full expression with an AND to return FALSE, although both expressions
given as operands alone return TRUE (file exists and _skip is "NOTFOUND").
As Alex suggested, perhaps the reason is that 1 is treated as a plain variable
and set to 0 (LDAP_FOUND was FALSE for me) and in the consequence in AND
expressions, which are internally using perhaps 1, true and true is always
evaluated to 0 == false?
So perhaps it might make sense if cmake checked for something like readonly
variables?
Wild guesses, I hope you can make more out of this :)
Regards
Friedrich
More information about the Kde-buildsystem
mailing list