I solve the problem by adding the move step in the same ADD_CUSTOM_COMAND<br><br>Here is the new code. Any ideas for <br><br>#BEGIN<br><br>MACRO ( GENERATE_SLICE2CPP_RULES GENERATED_CPP_LIST GENERATED_HEADER_LIST )<br><br>
&nbsp;&nbsp;&nbsp; FOREACH( SLICE_SOURCE_BASENAME ${ARGN} )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND( GEN_SLICE_RULES_SLICE_DEPENDS &quot;${SLICE_SOURCE_DIR}/${PROJECT_NAMESPACE}/${SLICE_SOURCE_BASENAME}&quot; )<br>&nbsp;&nbsp;&nbsp; ENDFOREACH( SLICE_SOURCE_BASENAME ${ARGN} )
<br><br><br>&nbsp;&nbsp;&nbsp; FOREACH( SLICE_SOURCE_BASENAME ${ARGN} )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET( SLICE_SOURCE &quot;${SLICE_SOURCE_DIR}/${PROJECT_NAMESPACE}/${SLICE_SOURCE_BASENAME}&quot; )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET( DEPENDS ${GEN_SLICE_RULES_SLICE_DEPENDS} )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STRING( REGEX REPLACE &quot;\\.ice&quot; .cpp SOURCE_OUTPUT_BASENAME &quot;${SLICE_SOURCE_BASENAME}&quot; )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STRING( REGEX REPLACE &quot;\\.ice&quot; .h HEADER_OUTPUT_BASENAME &quot;${SLICE_SOURCE_BASENAME}&quot; )
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE ( STATUS &quot;Source file to generate: ${SOURCE_OUTPUT_BASENAME}&quot; )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE ( STATUS &quot;Header file to generate: ${HEADER_OUTPUT_BASENAME}&quot; )<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADD_CUSTOM_COMMAND(
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTPUT&nbsp; ${PROJECT_SOURCE_DIR}/src/${SOURCE_OUTPUT_BASENAME} ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAMESPACE}/${HEADER_OUTPUT_BASENAME}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${SLICE2CPP_COMMAND} ${SLICE_ARGS} ${SLICE_SOURCE}
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${MOVE_FILE_COMMAND} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_OUTPUT_BASENAME} ${PROJECT_SOURCE_DIR}/src/${SOURCE_OUTPUT_BASENAME}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${MOVE_FILE_COMMAND} ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_OUTPUT_BASENAME} ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAMESPACE}/${HEADER_OUTPUT_BASENAME}
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEPENDS ${DEPENDS}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMENT &quot;-- Generating ${SOURCE_OUTPUT_BASENAME} ${HEADER_OUTPUT_BASENAME} file from ${SLICE_SOURCE_BASENAME}&quot;)<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND ( &quot;${GENERATED_CPP_LIST}&quot; &quot;${PROJECT_SOURCE_DIR}/src/${SOURCE_OUTPUT_BASENAME}&quot; )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND ( &quot;${GENERATED_HEADER_LIST}&quot; &quot;${PROJECT_SOURCE_DIR}/include/${PROJECT_NAMESPACE}/${HEADER_OUTPUT_BASENAME}&quot; )<br>&nbsp;&nbsp;&nbsp; ENDFOREACH( SLICE_SOURCE_BASENAME ${ARGN} )<br><br>ENDMACRO ( GENERATE_SLICE2CPP_RULES GENERATED_CPP_LIST GENERATED_HEADER_LIST )
<br><br>#END<br><br><br>When i try to separate the command that move generated files in other ADD_CUSTOM_COMMAND call<br><br>i get this error:<br><br>pepone@sirius ~/proyects/ydra-ipluginservice/build $ make<br>[ 50%] -- Generating 
IPluginService.cpp IPluginService.h file from IPluginService.ice<br>make[2]: *** No rule to make target `../src/IPluginService.cpp&#39;, needed by `CMakeFiles/IPluginService.dir/depend.make.mark&#39;.&nbsp; Stop.<br>make[1]: *** [CMakeFiles/IPluginService.dir/all] Error 2
<br>make: *** [all] Error 2<br><br>Here is the cmake macro when i get the error.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADD_CUSTOM_COMMAND(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTPUT&nbsp; ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_OUTPUT_BASENAME} ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_OUTPUT_BASENAME}
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${SLICE2CPP_COMMAND} ${SLICE_ARGS} ${SLICE_SOURCE}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEPENDS ${DEPENDS}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMENT &quot;-- Generating ${SOURCE_OUTPUT_BASENAME} ${HEADER_OUTPUT_BASENAME} file from ${SLICE_SOURCE_BASENAME}&quot;)
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADD_CUSTOM_COMMAND(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTPUT&nbsp; ${PROJECT_SOURCE_DIR}/src/${SOURCE_OUTPUT_BASENAME} ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAMESPACE}/${HEADER_OUTPUT_BASENAME}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${MOVE_FILE_COMMAND} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_OUTPUT_BASENAME} ${PROJECT_SOURCE_DIR}/src/${SOURCE_OUTPUT_BASENAME}
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${MOVE_FILE_COMMAND} ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_OUTPUT_BASENAME} ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAMESPACE}/${HEADER_OUTPUT_BASENAME}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_OUTPUT_BASENAME} ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_OUTPUT_BASENAME}
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMENT &quot;-- Moving generated file ${SOURCE_OUTPUT_BASENAME} to ${PROJECT_SOURCE_DIR}/src&quot;)<br><br><br><br>Any ideas why this fail when ADD_CUSTOM_COMMAND is break in tow ADD_CUSTOM_COMMAND<br><br>
Thanks in advance<br>