<div dir="ltr">On Thu, Jan 21, 2016 at 3:26 PM, Vania Joloboff <span dir="ltr"><<a href="mailto:vania.joloboff@inria.fr" target="_blank">vania.joloboff@inria.fr</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">HI Petr<br>
<br>
Thanks for the suggestion.<br>
But this will erase the existing compile definitions, won't it ?<br>
So may be I should do a get_property first,<br>
append my new definitions and reset the property ?<br>
I'll try anyway...<br></blockquote><div><br></div><div>This would erase the previous value of the property COMPILE_DEFINITIONS specified on the source file(s), if you've already provided one for it. But the globally specified compilation definitions, flags etc. do not get copied into these per-source properties. Instead, the final command line used for compiling a source is combined from the global, target, and source file properties (and relevant variables and other things).<br><br></div><div>If you really need to append to the property, though, you can use APPEND or APPEND_STRING arguments before the PROPERTY keyword; refer to CMake docs for more details.<br><br></div><div>Petr<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Vania<span class=""><br>
<br>
On 01/21/2016 03:21 PM, Petr Kmoch wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Hi Vania.<br>
<br>
For your case, it's best to forget about the not-as-convenient-as-they-could-be convenience functions set_*_properties, and just invoke set_property:<br>
<br>
set_property(<br>
  SOURCE source.cpp<br>
  PROPERTY COMPILE_DEFINITIONS<br>
    VAR1=${MY_VAR1} VAR2=${MY_VAR2}<br>
)<br>
<br>
Petr<br>
<br></span><span class="">
On Thu, Jan 21, 2016 at 3:14 PM, Vania Joloboff <<a href="mailto:vania.joloboff@inria.fr" target="_blank">vania.joloboff@inria.fr</a> <mailto:<a href="mailto:vania.joloboff@inria.fr" target="_blank">vania.joloboff@inria.fr</a>>> wrote:<br>
<br>
    Hi<br>
<br>
    I want to add two definitions to compile one specific files<br>
    in addition to the global definitions.<br>
    I have the following problem. If I use<br>
<br>
    set_source_files_properties(source.cpp<br>
    PROPERTIES<br>
    COMPILE_DEFINITIONS VAR1=${MY_VAR1} VAR2=${MY_VAR2} )<br>
<br>
    then I get error message incorrect number of arguments for<br>
    set_source_files_properties<br>
<br>
    If I put<br>
    set_source_files_properties(source.cpp<br>
    PROPERTIES COMPILE_DEFINITIONS "VAR1=${MY_VAR1} VAR2=${MY_VAR2}" )<br>
<br>
    then it generates strangely enough the compile command<br>
<br>
    /usr/bin/c++ -DVAR1="path1 VAR2=path2" ... source.cpp<br>
<br>
    with the double quotes as above, which gives a weird value to VAR1<br>
    and no value to VAR2<br>
<br>
    If I use twice set_source_files_properties<br>
    the first one is overwritten by the second<br>
    and I only get the definition of VAR2<br>
<br>
    What am I supposed to do ?<br>
<br>
    Thankx<br>
<br>
    PS I am using cmake 3.2.2 on Linux Mint.<br>
<br>
    -- <br></span>
    Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" rel="noreferrer" target="_blank">http://www.kitware.com</a>><span class=""><br>
<br>
    Please keep messages on-topic and check the CMake FAQ at:<br>
    <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
    Kitware offers various services to support the CMake community.<br>
    For more information on each offering, please visit:<br>
<br>
    CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
    CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
    CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
    Visit other Kitware open-source projects at<br>
    <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
<br>
<br>
</span></blockquote>
<br>
</blockquote></div><br></div></div>