[Cmake] does the GENERATED property work ?

Alexander Neundorf a.neundorf-work at gmx.net
Wed Sep 8 16:47:47 EDT 2004


> Does this example work for you: 
>  
> http://public.kitware.com/Wiki/
CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F 
>  
> I did fix a bug where generated .h files did not get properly set to 
> generated. 
> But that does not seem to be your case. 
>  
> -Bill 
 
It still doesn't work here. 
I inserted some debug output into cmake: 
 
hammer:/usr/src/xscale$ cmake . 
-- Check for working C compiler: gcc -- works 
-- Check for working CXX compiler: c++ -- works 
cmMakefile 1: name: -/home/src/xscale/firmware/qt4test/
ecos-iq80321/../../lib/qt4/src/core/thread/qthread_moc.cpp.rule is 
generated 
cmMakefile 2: name: -/home/src/xscale/firmware/qt4test/ 
ecos-iq80321/../../lib/qt4/src/core/thread/qthread_moc.cpp is generated 
 
//the two lines above come from cmMakefile::addCustomCommandToOutput(), 
where the GENERATED property is set to 1 
 
name: -/home/src/xscale/firmware/qt4test/ecos-iq80321/../main.cpp- 
generated: 0 
name: -/home/src/xscale/firmware/qt4test/ecos-iq80321/../../lib/qt4/src/
core/global/qglobal.cpp- generated: 0 
... 
name: -/home/src/xscale/firmware/qt4test/ecos-iq80321/../../lib/qt4/src/
core/codecs/qfontlaocodec.cpp- generated: 0 
name: -/home/src/xscale/firmware/qt4test/ecos-iq80321/../../lib/qt4/src/
core/thread/qthread_moc.cpp- generated: 0 
 
//these lines come from cmSourceFile::SetName(), note how the path is 
exactly the same as above but the GENERATED property isn't set anymore 
(created using this->GetPropertyAsBool("GENERATED"); 
 
CMake Error: can not find file /home/src/xscale/firmware/qt4test/
ecos-iq80321/../../lib/qt4/src/core/thread/qthread_moc.cpp 
 
And finally cmake complains that it can't find the file... 
Here is my macro again, as you see now it uses absolute paths, and I 
don't build out-of-source, so CMAKE_CURRENT_SOURCE_DIR should be ok. 
 
MACRO(QT4_ADD_MOC_H_FILES _the_MOC_SRCS) 
   FOREACH (_current_FILE ${ARGN}) 
      GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE) 
      GET_FILENAME_COMPONENT(_path ${_current_FILE} PATH) 
      SET(_moc ${_path}/${_basename}_moc.cpp) 
 
   ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${_moc} 
      COMMAND ${_MOC4} 
      ARGS ${_header} -o ${CMAKE_CURRENT_SOURCE_DIR}/${_moc} 
      DEPENDS ${_header} 
   )                 
 
   SET_SOURCE_FILES_PROPERTIES( 
      ${CMAKE_CURRENT_SOURCE_DIR}/${_moc} 
      PROPERTIES 
      GENERATED true 
   )  
 
   SET(${_the_MOC_SRCS} ${${_the_MOC_SRCS}} ${_moc}) 
    
   ENDFOREACH (_current_FILE) 
ENDMACRO(QT4_ADD_MOC_H_FILES) 
 
Any ideas ? 
 
Bye 
Alex 
 

-- 
Supergünstige DSL-Tarife + WLAN-Router für 0,- EUR*
Jetzt zu GMX wechseln und sparen http://www.gmx.net/de/go/dsl



More information about the Cmake mailing list