<div dir="ltr">It might be easier if you showed the whole CMakeLists.txt file so we can see the full picture. Is it available somewhere you can link to, or even better if it's small enough, just post it inline here.<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 18, 2017 at 1:21 PM, Florian Lindner <span dir="ltr"><<a href="mailto:mailinglists@xgm.de" target="_blank">mailinglists@xgm.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 18.07.2017 um 10:59 schrieb Craig Scott:<br>
> You appear to be setting a GLOBAL property where you probably meant DIRECTORY. You could also consider setting the<br>
> target property instead rather than applying it to all targets (unless that's what you want).<br>
<br>
I tried to set the property on all targets, therefore I thought GLOBAL is the right thing.<br>
<br>
However,<br>
<br>
set_property(DIRECTORY "${CMAKE_SOURCE_DIR}/src" APPEND<br>
  PROPERTY COMPILE_DEFINITIONS "-DFOO")<br>
<br>
hasn't had any effect either.<br>
<br>
set_property(TARGET testprecice APPEND<br>
  PROPERTY COMPILE_DEFINITIONS "FOO")<br>
<br>
works. But setting it on all targets is exactly what I want. How can I do that?<br>
<br>
Best,<br>
Florian<br>
<br>
><br>
><br>
> On Tue, Jul 18, 2017 at 12:56 PM, Florian Lindner <<a href="mailto:mailinglists@xgm.de">mailinglists@xgm.de</a> <mailto:<a href="mailto:mailinglists@xgm.de">mailinglists@xgm.de</a>>> wrote:<br>
><br>
>     Hello,<br>
><br>
>     I want to add compile definitions. Since I want to use generator expressions, I can't use add_definitions, but have to<br>
>     use the COMPILE_DEFINITIONS property, but neither:<br>
><br>
>     set_property(GLOBAL APPEND<br>
>       PROPERTY COMPILE_DEFINITIONS "-DFOO")<br>
><br>
>     for testing<br>
><br>
>     or<br>
><br>
>     set_property(GLOBAL APPEND<br>
>       PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:-DDebug>)<br>
><br>
>     which should be final result, produces any -DFOO compiler switches.<br>
><br>
>     I also tried placing it before and after the add_executable call.<br>
><br>
>     What is wrong with that call?<br>
><br>
>     Thanks,<br>
>     Florian<br>
>     --<br>
><br>
>     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>><br>
><br>
>     Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
>     <<a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>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" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a> <<a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a>><br>
>     CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a> <<a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>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/<wbr>training.html</a> <<a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a>><br>
><br>
>     Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
>     <<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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/<wbr>mailman/listinfo/cmake</a> <<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a>><br>
><br>
><br>
><br>
<span class="HOEnZb"><font color="#888888">><br>
> --<br>
> Craig Scott<br>
> Melbourne, Australia<br>
> <a href="https://crascit.com" rel="noreferrer" target="_blank">https://crascit.com</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div></div></div></div></div></div></div>
</div>