[CMake] QT4_GENERATE_MOC error when building a QTEST

Tim Sutton tim at linfiniti.com
Mon May 21 00:43:55 EDT 2007


Hi

I'm trying to build qtests for Qt4. The test is a cpp file only and  
needs a MOC generated for the cpp file and included at the end. I  
tried adding QT4_GENERATE_MOC and the moc file is now being generated  
correctly, but a build error follows immediately. The relevant bits  
of CMakeLists.txt and the offending error are listed below. Im using  
cmake version 2.4-patch 6 on mac osx. If someone can tell me how to  
dispense with the above mentioned error I'd be most grateful....

Regards

Tim

      16 SET(experimenttest_SRCS
      17   omgexperimenttest.cpp
      18   )
      19 # This should work but at the moment it generates the file  
then produces         an error like this:
      20 #[ 79%] Generating ../../../src/tests/moc_omgexperimenttest.cxx
      21 #make[2]: *** No rule to make target  
`moc_omgexperimenttest.cxx', needed         by `src/tests/CMakeFiles/ 
experimenttest.dir/depend.make.mark'.  Stop.
      22 #make[1]: *** [src/tests/CMakeFiles/experimenttest.dir/all]  
Error 2
      23 #make: *** [all] Error 2
      24 QT4_GENERATE_MOC(
      25   ${CMAKE_CURRENT_SOURCE_DIR}/omgexperimenttest.cpp
      26   moc_omgexperimenttest.cxx
      27   )


More information about the CMake mailing list