[cmake-developers] Unique compile definitions

David Cole david.cole at kitware.com
Sun Aug 19 17:20:40 EDT 2012


On Sun, Aug 19, 2012 at 4:17 PM, Stephen Kelly <steveire at gmail.com> wrote:

> Brad King wrote:
>
> > On 8/16/2012 11:42 AM, Stephen Kelly wrote:
> >> I thought that I could make -DNAME="value" appear twice with this code:
> >>
> >>  add_definitions(-D"NAME=Value" -DNAME="Value")
> >
> > CMake syntax treats quotes in the middle of an unquoted argument
> > literally.  The double quotes are part of the string.  This code:
> >
> >
>
> http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmMakefile.cxx;hb=v2.8.9#l1269
> >
> > does not recognize it as a definition flag.
> >
> >> This might be intentional, but then the code in AppendDefines is dead
> and
> >> should be removed. If it is unintentional, then I have found a bug.
> >
> > The code should be active if the value needs quoting on the
> > generated shell command line:
> >
> >  set_property(TARGET foo PROPERTY COMPILE_DEFINITIONS "FOO=with space")
>
> What you say makes sense. But maybe the comment I pointed out should be
> removed or made more clear. It doesn't seem to relate to what the code is
> actually about. What do you think?
>
> >> There is still Watcom escaping which I did not test though. As the
> >> current patch stores unescaped defines, the escaped defines may not be
> >> unique.
> >
> > The defines CMake knows about will be unique.  It is only the
> > raw -D flag that leaks through the above-linked code without
> > being recognized that might create a duplicate.  Rather than
> > try to handle the historical pre-quoted case and guess what
> > the user meant we should either make no change or just add
> > a warning for it.
>
> Ok, sounds fine to me. In that case, the branch is almost ready to merge to
> next. All that remains is to test the visual studio patch. Can I just merge
> the branch and fix any errors related to that which appear on the
> dashboard,
> or should I wait and ask someone to test it first?
>
> Thanks,
>
> Steve.
>
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>


I could run an Experimental based on this branch with Visual Studio and
point you to the CDash results if you'd like.

Maybe not till tomorrow, though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20120819/6ca4dc98/attachment.html>


More information about the cmake-developers mailing list