${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}<br><br><div><br><div class="gmail_quote">On Sat, Dec 13, 2008 at 1:31 PM, Tron Thomas <span dir="ltr"><<a href="mailto:tron.thomas@verizon.net">tron.thomas@verizon.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I have tried a different approach that has been more successful:<br>
<br>
add_custom_target(CopyXML ${CMAKE_COMMAND} -E copy_directory<div class="Ih2E3d"><br>
${CMAKE_CURRENT_SOURCE_DIR}/XML ${EXECUTABLE_OUTPUT_PATH}<br>
<br></div>
add_dependencies(UnitTest CopyXML)<br>
<br>
This will always copy the files whether they need to be updated or not, however I cannot think of anything else that will cause the file to get copied.<br>
<br>
Another problem is that when I build this target from an IDE like Apple's Xcode, the file are copied to ${EXECUTABLE_OUTPUT_PATH}, however the built executable is copied to ${EXECUTABLE_OUTPUT_PATH}/Debug when building the debug version the application.<br>
<br>
How can I get the copied files and built executable to appear in the same directory.<div><div></div><div class="Wj3C7c"><br>
<br>
On Dec 11, 2008, at 8:44 o'clock, Tron Thomas wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a project configured with CMake that needs to have set of XML files copied to the directory where executables are built so that a unit test that relies on these files can execute.<br>
<br>
I tried to create a custom command that should copy the files and tried to set that command up as dependency of the unit test application. However when the application builds the files are not copied to the needed directory.<br>
<br>
Here is the gist of how I tried to perform the copy:<br>
<br>
file(GLOB SourceXMLFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/XML XML/*.xml)<br>
<br>
foreach(File ${SourceXMLFiles})<br>
set(XMLFiles "${XMLFiles} ${EXECUTABLE_OUTPUT_PATH}/${File}")<br>
endforeach(File)<br>
<br>
add_custom_command(OUTPUT ${XMLFiles}<br>
COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory<br>
${CMAKE_CURRENT_SOURCE_DIR}/XML ${EXECUTABLE_OUTPUT_PATH}<br>
DEPENDS ${SourceXMLFiles})<br>
<br>
add_dependencies(UnitTest ${XMLFiles})<br>
<br>
What can be done to copy the needed files to the unit test directory?<br>
<br>
</blockquote>
<br>
_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org" target="_blank">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>