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") > 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. -Brad -- 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
