[CMake] cmake qt4 Lplates again

luxInteg lux-integ at btconnect.com
Sat Dec 11 19:05:24 EST 2010


On Saturday 11 December 2010 17:46:37 luxInteg wrote:
> Greetings,
> 
> Still with    cmake L-plates firmly on ( with a Qt4  project  )  I have now
> stumbled into this:-
> 
> I have a series of header files to compile into  .cpp files  via the
> QT4_WRAP_CPP() utility.  Just one of the file needs to  'compiled'
> beforehand    then compiled  to object code  with  other normal .cpp
> source- files beforehand.   I thus want to   set the directory for  the
> generated 'transitory' file. (for obvious reasons  such as    to know
> where it is!)
> 
As an update,  it turns out the the odd file (call this this fileZ in question 
is compiled into  a    'moc' file by the qt moc compiler and has the extension 
.moc.    The  starting file is a .cpp file which does not seem to need to  use 
of QT4_WRAP_CPP()?  (though I am  not  expert enough to be sure).

I thus tried an add_custom_command()  (gleaned from moc --help))  that looks 
like the following:-

configure_file(PATH/to/fileZ.cpp PATH/to/fileZ2.h @COPYONLY)
set(MOC_cmd "/opt/qt4/bin/moc") 
set(PRePRCESSOR_STIRNG "xxxx yyy zzz")

 ADD_CUSTOM_COMMAND(
   OUTPUT -o ${CMAKE_BINARY_DIR}/path/to/fileZ.moc
   COMMAND  ${MOC_cmd} 
-I${QT_INCLUDES}
-I${CMAKE_SOURCE_DIR}/path/to
-E${PRePRCESSOR_STIRNG}
${CMAKE_BINARY_DIR}/path/to/fileZ2.h
   DEPENDS ${CMAKE_SOURCE_DIR}/path/to/fileZ.cpp )

but (apart from the first line)  it did not work.

advice would be appreiated.


More information about the CMake mailing list