On Sunday 05 December 2010 13:51:12 Michael Wild wrote: > On 12/05/2010 02:04 AM, luxInteg wrote: > > On Thursday 02 December 2010 07:48:55 Michael Wild wrote: > >>>> Use ADD_CUSTOM_COMMAND. > >>> > >>> @Michael: that advice is not correct. add_custom_command sets up a > >>> command to be run at "make" time. Instead, the execute_process command > >>> should be used to run a command at "CMake" time which is what the OP > >>> needs to generate his *.cpp files. > >>> > >>> @LuxInteg: See the CMakeLists.txt file at > >>> http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/bindings/qt_gui/p > >>> yq t4/ > >>> > >>> for an example of generating source code with sip. > >>> > >>> Alan > >> > >> Huh, why can't he run sip at build time? If you do: > >> > >> find_program(SIP_EXECUTABLE sip) > >> > >> add_custom_command(OUTPUT > >> > >> ${CMAKE_CURRENT_BINARY_DIR}/fileC.cpp > >> ${CMAKE_CURRENT_BINARY_DIR}/fileD.cpp > >> > >> COMMAND ${SIP_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} > >> > >> ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip > >> > >> DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip > >> COMMENT "Processing ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip" > >> VERBATIM) > >> > >> add_library(myPythonExtension SHARED > >> > >> ${CMAKE_CURRENT_BINARY_DIR}/fileC.cpp > >> ${CMAKE_CURRENT_BINARY_DIR}/fileD.cpp) > >> > >> # possibly link with required libraries here... > > > > Thanks for your hep so far > > > > I have been experimenting on the above with the following results:- > > > > When the dependency has other dependencies the above appears to fail; > > i.e when filA.sip calls some file say PyQt4/QTCore/somefile.sip. > > (And I do not know of anyway of fitting this inside the > > add_custom_command() function.) > > > > I tried beforehand > > > > this:- > > > > set(PYQt4_SIP_FILES /usr/share/sip/PyQt4) > > > > then > > > > COMMAND ${SIP_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} > > > > ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip > > > > DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip > > ${PYQt4_SIP_FILES}/PyQt4/QTCore/somefile.sip > > MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip > > > > I even tried (the penultimate line) with ${PYQt4_SIP_FILES}/PyQt4/ > > > > but each time it comes back with > > > > "sip: Unable to find file "QtCore/somefile.sip" " > > > > I am using a FindSIP.cmake that kde4 uses. > > > > Advice would be appreciated > > > > luxInteg > > The DEPENDS option tells CMake about the dependency on somefile.sip, but > not sip. You also need to pass "-I ${PYQT4_SIP_FILES}" to the sip > processor. > > One word of advice: you seem to spurn documentation, but you really > should read it. advice taken and have been reading
The appropriate sip command (appendage) for the above appears to be:- -I${SIP_PATH} -s ".cpp" -t WS_X11 -t Qt$version -w *version is your qtversion). HOWEVER I am encountering severe linking problems. _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake