[CMake] QT_WRAP_CPP issue -- help!

Amit Ramesh amit.ramesh at cshs.org
Thu Oct 27 17:00:35 EDT 2005


Hi,

     I have recently started using CMake and find it to be an  
excellent tool for our cross-platform application. I am in the  
process of creating a set of macros for our internal use so that it  
abstracts out most of the CMake details and lets developers just list  
out their files.

     The problem I am running into is that when I don't use my macro  
and call QT_WRAP_CPP directly in the CMakeLists.txt file, everything  
is fine, however when the same call is made from within my macro, I  
get errors from CMake. Following is an example of what I am doing and  
the errors from CMake.

---- Working version -----

PROJECT (mylib)

:
:

SET (MOC_HEADERS
     a.h
     b.h
)

QT_WRAP_CPP (mylib MOC_FILES ${MOC_HEADERS})
ADD_LIBRARY (mylib STATIC ${SRCS} ${MOC_FILES})


---- Non-working version -----

PROJECT (mylib)

:
:

SET (MOC_HEADERS
     a.h
     b.h
)

OUR_MACRO_MAKE_LIB ()

#
# MACRO (OUR_MACRO_MAKE_LIB)
#
# QT_WRAP_CPP (${PROJECT_NAME} MOC_FILES ${MOC_HEADERS})
# ADD_LIBRARY (${PROJECT_NAME} STATIC ${SRCS} ${MOC_FILES})
#
# ENDMACRO (OUR_MACRO_MAKE_LIB)

---------------------------------------------

     I get the following error on compiling the non-working version  
with CMake (2.2):

CMake Error: Attempt to add a custom rule to output "moc_a.cxx" which  
already has a custom rule.
CMake Error: Attempt to add a custom rule to output "moc_b.cxx" which  
already has a custom rule.


     Can someone throw light on how to solve this problem, or at  
least some means by which I can see more output on what's going on so  
that I can debug the issue.

     Any help in this regard is much appreciated.

Thanks!
Amit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20051027/dfe7160f/attachment.htm


More information about the CMake mailing list