Thank you very much, Michael. It works
-----邮件原件----- 发件人: Michael Wild [mailto:them...@gmail.com] 发送时间: 2010年5月5日 20:06 收件人: suds 抄送: cmake@cmake.org 主题: Re: [CMake] I can use add_custom_command in cmake On 5. May, 2010, at 10:20 , suds wrote: > Hi there: > I am new to cmake and I am using Kdevelop, actually , I am new to linux. > In my project, there are some ice slice files which must be custom > parsed and generate some cpp/h files. > So I use the command below to tell cmake to call slice2cpp to generate > the cpp/h files. > But every times I build the project, no cpp/h files were generate, and > I event can not find why. > The only error message I can see is to tell me that the target source > file was not found ( because this file was not generated ) I can't > figure out wht happend, and I even don't know to to trace the poblem > Any help on this is appreciated > > > add_custom_command( OUTPUT ../TianShanIce.cpp > COMMAND /opt/Ice-3.3/bin/slice2cpp -I > /opt/Ice-3.3/slice/ -I../ --output-dir ../ ../TianShanIce.ICE > DEPENDS ../TianShanIce.ICE ) add_library(TianShanIce > SHARED ../TianShanIce.cpp) > > > > Suds Always use full paths in custom commands (and use find_program) find_program(SLICE2CPP_EXECUTABLE slice2cpp PATHS /opt/Ice-3.3/bin) set(out_dir "${CMAKE_CURRENT_BINARY_DIR}/.." set(out_file "${out_dir}/TianShanIce.cpp") add_custom_command(OUTPUT "${out_file}" COMMAND "${SLICE2CPP_EXECUTABLE}" -I /opt/Ice-3.3/slice/ -I "${out_dir}" --output-dir "${out_dir}" "${CMAKE_CURRENT_SOURCE_DIR}/../TianShanIce.ICE" ) add_library(TianShanIce SHARED "${out_file}") Hope this helps Michael _______________________________________________ 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