<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Oct 2, 2008 at 6:41 PM, Jesse Corrington <span dir="ltr">&lt;<a href="mailto:jesse.corrington@gmail.com">jesse.corrington@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">Ok, I got a little further, but still not exactly what I wanted. I had some sloppy quotes after doing a poor job of converting my old post build step into this new way of doing things. It is now partially functional. I can compile the script if I right click on the project and do build. I have two problems. One is that the script file is still not listed under the project in visual studio. The other is that when I rebuild the whole solution, this project doesn&#39;t get built. I have explicitly select to build it. Below is my new code. Thanks for all the help.<div>

<br></div><div><div class="Ih2E3d"><div>ADD_CUSTOM_COMMAND(&nbsp;</div><div><span style="white-space: pre;">        </span>OUTPUT ${binDirNative}\\main.js.bin</div></div><div><span style="white-space: pre;">        </span>COMMAND ${COMPILE_SCRIPT} ${binDirNative}\\main.js -o ${binDirNative}\\main.js.bin</div>

<div><span style="white-space: pre;">        </span>DEPENDS ${binDirNative}\\main.js VERBATIM )</div></div></div></blockquote><div>&nbsp;Why not using ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_CURRENT_BINARY_DIR}?<br>Also, you should use native paths here (that is forward slashes).<br>
Also, you may use MAIN_DEPENDENCY in one of these commands, cmake will put this file directly into project (see help for more information).<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr"><div><div></div><div><span style="white-space: pre;">                        </span></div><div>ADD_CUSTOM_TARGET(</div><div>
<span style="white-space: pre;">        </span>Test DEPENDS ${binDirNative}\\main.js.bin VERBATIM )</div><div><div></div><div class="Wj3C7c"><div><br></div><div><br></div><br><div class="gmail_quote">On Thu, Oct 2, 2008 at 7:15 AM, Jesse Corrington <span dir="ltr">&lt;<a href="mailto:jesse.corrington@gmail.com" target="_blank">jesse.corrington@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">I have been playing around with this, and can&#39;t seem to figure it out. My project gets created, but it doesn&#39;t compile the script and in visual studio the script is not listed under the project in the solution explorer. There is a .rule file, which almost points to my script, but has a strange path. It&#39;s path ends up as CMAKE_SOURCE_PATH/full path to script/.rule, which is bad because it has c:\ in it twice. Any ideas what I&#39;m doing wrong. If done correctly, will I be able to see the scripts listed in visual studio for editing inside the IDE? Below is my source. Thanks<div>


<br></div><div><div>ADD_CUSTOM_COMMAND(&nbsp;</div><div><span style="white-space: pre;">        </span>OUTPUT &quot;\&quot;${binDirNative}\\main.js.bin\&quot;&quot;</div><div><span style="white-space: pre;">        </span>COMMAND ${COMPILE_SCRIPT} &quot;-o \&quot;${binDirNative}\\main.js.bin\&quot;&quot;</div>


<div><span style="white-space: pre;">        </span>DEPENDS &quot;\&quot;${binDirNative}\\main.js\&quot;&quot; )</div><div><span style="white-space: pre;">                        </span></div><div>ADD_CUSTOM_TARGET(</div>
<div><span style="white-space: pre;">        </span>Test DEPENDS &quot;\&quot;${binDirNative}\\mo\\main.sjs.bin\&quot;&quot; VERBATIM )</div><div><div></div><div><br><div class="gmail_quote">On Wed, Sep 24, 2008 at 7:48 AM, Timenkov Yuri <span dir="ltr">&lt;<a href="mailto:ytimenkov@gmail.com" target="_blank">ytimenkov@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">Use add_custom_command to compile your files. This one accepts source and destination file names for proper dependency handling.<br>


Next, use add_custom_target command with dependencies on add_custom_target&#39;s output.<br>
For example:<br>add_custom_command(OUTPUT myscript.compiled<br>&nbsp;COMMAND compile_script myscript.src<br>&nbsp;DEPENDS myscript.src)<br>add_custom_target(BuildScripts DEPENDS myscript.compiled VERBATIM)<br><br>Something like this. See documentation for both commands. Of course, you can use single custom target for all your scripts, and you can write macro to wrap script&#39;s sources with add_custom_command.<br>



<br><br><div class="gmail_quote"><div>On Tue, Sep 23, 2008 at 1:43 AM, Jesse Corrington <span dir="ltr">&lt;<a href="mailto:jesse.corrington@gmail.com" target="_blank">jesse.corrington@gmail.com</a>&gt;</span> wrote:<br>


</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
<div dir="ltr">I&#39;m trying to create a custom target for compiling scripts in MSVC, but I can&#39;t seem to find anyway to add the files to the project when using ADD_CUSTOM_TARGET. I just want to be able to add files to a custom target project and then specify a post build step to compile the scripts with our internal script compiler. The current hack I have in place is to use ADD_EXECUTABLE and just use a dummy cpp file with an empty main. I figure there must be a better way than this.</div>




<br></div>_______________________________________________<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></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>