<br><div class="gmail_quote">2011/4/21 David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div><div></div><div class="h5">On Thu, Apr 21, 2011 at 9:48 AM, Maxime Lecourt <span dir="ltr"><<a href="mailto:maxime.lecourt@gmail.com" target="_blank">maxime.lecourt@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">
Hi,<br><br>I'm currently trying to use add_custom_command, but I do not get any output (it's working fine in other projects, with Bison and Flex).<br><br>Basically, I have a CMakeLists.txt file with<br><br>include(CMakeCallPerl.cmake)<br>
PERL_SCRIPT("${GLISS_PATH}/<a href="http://nmp2nml.pl" target="_blank">nmp2nml.pl</a>" "ppc.nmp")<br><br><br>And in my CMakeCallPerl.cmake file :<br><br>find_program(PERL perl)<br>IF(PERL)<br> MACRO(PERL_SCRIPT SCRIPT FILENAME)<br>
GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)<br> GET_FILENAME_COMPONENT(PREFIX "${FILENAME}" NAME_WE)<br> SET(OUTFILE "${PREFIX}.nml")<br> MESSAGE(STATUS "${PERL} ${SCRIPT} ${FILENAME} ${OUTFILE}")<br>
ADD_CUSTOM_COMMAND(<br> OUTPUT "${OUTFILE}"<br> COMMAND "${PERL}"<br> "${SCRIPT}"<br> "${FILENAME}"<br> "${OUTFILE}"<br> )<br> SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)<br>
ENDMACRO(PERL_SCRIPT)<br>ENDIF(PERL)<br><br>What am I doing wrong ?<br><br>Copy/Pasting the MESSAGE output in command line, everything works fine, but not when compiling after generating with CMake.<br>(it looks like this : C:/Win16App/rational/TestRealTime/bin/intel/win32/perl.exe D:/workspace/ppc/../gliss/<a href="http://nmp2nml.pl" target="_blank">nmp2nml.pl</a> ppc.nmp ppc.nml)<br>
There is also no mention for Perl in any CMake generated file.<br>Using Windows XP and MinGW<br><br>Regards,<br><font color="#888888"><br>Maxime<br>
</font><br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br><br>The output of the custom command needs to be used by something in order for a build to trigger it...<br>
<br>After calling your macro, you can depend on the output of it with a custom target if there is no other dependency on it:<br><br> add_custom_target(run_perl_scripts ALL<br> DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/file1.nml ${CMAKE_CURRENT_BINARY_DIR}/file2.nml ...<br>
)<br><br>Then a "make" will trigger running perl.<br><br>You should also probably add:<br> DEPENDS ${FILENAME} ${SCRIPT}<br>to the custom command so that it re-runs if the input or the script changes...<br><br>
<br>HTH,<br><font color="#888888">David<br><br>
</font></blockquote></div><br>Hi,<br>
<br>
that was indeed the problem, there was nothing using the target file.<br><br>Thank you<br><br>Maxime<br>