<div dir="ltr"><div>I think something like this:<br></div><div><br>add_executable(2 2.cpp)<br>add_executable(gen gen.cpp)<br><br>add_custom_command(OUTPUT 2.cpp<br> COMMAND gen "${CMAKE_CURRENT_SOURCE_DIR}/2.txt" -o 2.cpp<br>
DEPENDS 2.txt<br>)<br><br></div>Nils<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 12:00 PM, 王东岳 <span dir="ltr"><<a href="mailto:codewdy@gmail.com" target="_blank">codewdy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Well, I want to run an excutable when build like the following makefile:<div>2 : 2.cpp</div><div> g++ 2.cpp -o 2</div>
<div><br></div><div>2.cpp : gen</div><div> gen 2.txt -o 2.cpp</div><div><br></div><div>
gen : gen.cpp</div><div> g++ gen.cpp -o gen</div><div><br></div><div>So what should I do?</div><div>I just have learnt how to build a simple project,</div><span class="HOEnZb"><font color="#888888"><div><div><br></div>
-- <br><div style="text-align:right">
清华大学计算机系</div><div style="text-align:right">Tsinghua University CST</div><div style="text-align:right">王东岳</div><div style="text-align:right">Dongyue.Wang</div>
</div></font></span></div>
<br>--<br>
<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></div>