<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 29, 2014 at 12:27 AM, Zhang Xianyi <span dir="ltr"><<a href="mailto:traits.zhang@gmail.com" target="_blank">traits.zhang@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">Hi Decker,<div><br></div><div>Thank you for the answer.</div><div><br></div><div>If I want to debug test_double, the debugger will refer to <span style="font-size:18px;font-family:arial,sans-serif">${CMAKE_BINARY_DIR}/test_</span><span style="font-size:18px;font-family:arial,sans-serif">double.c. </span></div><div>I am not sure it is appropriate to debug a generated file.</div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div></blockquote><div>it's as valid as any other source file... if you're not on that machine you'll have to map it in a exact location (which is why I usuauly use a drive like M: for all work... whether subst, net use; truecrypt, VHD etc...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="HOEnZb"><font color="#888888"><div></div><div><span style="font-size:18px;font-family:arial,sans-serif"><br></span></div><div><span style="font-size:18px;font-family:arial,sans-serif">Xianyi</span></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2014-11-28 23:03 GMT+08:00 J Decker <span dir="ltr"><<a href="mailto:d3ck0r@gmail.com" target="_blank">d3ck0r@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Fri, Nov 28, 2014 at 1:29 AM, Zhang Xianyi <span dir="ltr"><<a href="mailto:traits.zhang@gmail.com" target="_blank">traits.zhang@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">







<p><span>Hi,</span></p><p><span>I want to use cmake for a library which supports different floating point precision.</span></p><p>In Makefile, I used $(*F)  to generate the different function name.</p><p>Could I use $(*F) in cmake?</p><p><br></p><p><span>==================</span></p><p><span>test.c</span></p>
<p><span></span>===============</p>
<p><span>#ifdef DOUBLE                                                                    </span></p>
<p><span>#define TYPE double                                                              </span></p>
<p><span>#else                                                                            </span></p>
<p><span>#define TYPE float                                                               </span></p>
<p><span>#endif                                                                           </span></p>
<p><span></span><br></p>
<p><span>void CNAME(TYPE * a)</span></p>
<p><span>{</span></p><p><span>  a[0]=1.0;</span></p>
<p><span>}</span></p>
<p><span></span><br></p></div></blockquote><div><br></div></span><div>CMakeLists.txt</div><div>====================</div><div> cmake_minimum_required(VERSION 2.8)</div><div><br></div><div><div>       add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/test_double.c</div><div>                           DEPENDS test.c</div><div>                           COMMAND ${CMAKE_COMMAND} -E copy_if_different test.c   ${CMAKE_BINARY_DIR}/test_double.c</div><div>                           COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/test_double.c</div><div>                           )</div></div><div><br></div><div><br></div><div>add_library( libtest   test.c  ${CMAKE_BINARY_DIR}/test_double.c )</div><div><br></div><div><div>SET_PROPERTY(SOURCE ${CMAKE_BINARY_DIR}/test_double.c</div><div>                 APPEND </div><div><span style="white-space:pre-wrap">           </span>PROPERTY COMPILE_DEFINITIONS "DOUBLE" ) </div></div><div><br></div><div>======================</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><div dir="ltr"><p></p>
<p><span>=</span><span>==========</span></p>
<p><span>Makefile</span></p>
<p><span></span>================</p><p>OBJS=test_single.o test_double.o</p><p>all:$(OBJS)</p><p>      ar -rua libtest.a $(OBJS)</p>
<p><span>test_single.o</span><span> : test.c</span></p>
<p><span>        $(</span><span>CC</span><span>) -DCNAME=$(</span><span>*F</span><span>) -UDOUBLE -c $</span><span><</span><span> -o $(</span><span>@F</span><span>)</span></p>
<p><span>test_double.o</span><span> : test.c</span></p>
<p><span>        $(</span><span>CC</span><span>) -DCNAME=$(</span><span>*F</span><span>) -DDOUBLE -c $</span><span><</span><span> -o $(</span><span>@F</span><span>)</span></p><p><span><br></span></p><p><span>============</span></p><p><span>Thank you</span></p><span><font color="#888888"><p><span>Xianyi</span></p></font></span></div>
<br></span>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>