[CMake] cmake cannot add clang cxx flags

Nils Gladitz nilsgladitz at gmail.com
Mon May 19 03:30:57 EDT 2014


On 05/19/2014 09:05 AM, Rashad M wrote:
> Hi all,
>
> I was trying to add a cxx flags to clang -Wno-#warnings. to supress a
> deprecated header warning.
>

>
> It is clear that -Wno-#warning is not parsed properly. This maybe due to
> clang warning flag starting with # symbol.
>
> Is there any way to add this flag to cmake.
>

I assume you are using the Makefiles generator?
In Makefiles # may start a comment.

CMake does not seem to escape # in that context (I don't know if it can 
be escaped for all make dialects at all/the same way).

A temporary workaround that may work is:
  -Wno-\\#warnings

This will likely break other generators.

Nils


More information about the CMake mailing list