<div class="gmail_quote">On Wed, Aug 25, 2010 at 3:17 PM, Neelima Mehdiratta <span dir="ltr"><<a href="mailto:nmehdiratta@decarta.com">nmehdiratta@decarta.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US"><div>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">ADD_CUSTOM_COMMAND(TARGET ${BIN_NAME}</span></font>
<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">
POST_BUILD</span></font></p>
<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">
WORKING_DIRECTORY ${SRC_DIR}</span></font></p>
<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"> COMMAND bash
./addtestscrpt</span></font></p>
<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"> COMMAND
${CMAKE_COMMAND} ${SRC_DIR}/DDSCommonTests/CMakeLists.txt</span></font></p>
<p class="MsoNormal" style=""><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">)</span></font></p><br></div></div></blockquote></div><br>I'm not sure, but I think you're very close to the right answer here. The problem with the above COMMAND is that it doesn't quite make sense - you can't specify a CMakeLists.txt file as an argument to CMake; it's not a scripting language in that sense, at least when it's doing build-tree configuration.<br>
<br>I think what you should do is the following. In your top-level CMakeLists.txt, have something like<br><br>IF (EXISTS ${CMAKE_BINARY_DIR}/testlist.cmake)<br> INCLUDE (${CMAKE_BINARY_DIR}/testlist.cmake)<br>ENDIF (EXISTS ${CMAKE_BINARY_DIR}/testlist.cmake)<br>
<br>and then change your custom to command to generate testlist.cmake in your build directory and then re-run cmake:<br><br>ADD_CUSTOM_COMMAND(TARGET ${CMAKE_BINARY_DIR}/testlist.cmake<br> POST_BUILD<br> WORKING_DIRECTORY ${CMAKE_BINARY_DIR}<br>
COMMAND bash addtestscript<br> COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}<br>)<br><br>You'll need to tweak the invocation of addtestscript to successfully generate testlist.cmake in the build directory, and then I think it'll all work.<br>
<br>Ceej<br>aka Chris Hillery<br>