[cmake-developers] Enabling more compiler warnings

Stephen Kelly steveire at gmail.com
Wed Nov 7 10:06:48 EST 2012


Brad King wrote:

> On 11/07/2012 09:40 AM, Stephen Kelly wrote:
>> Does the cmake regex system have a way to match word boundaries? I need
>> to be able to match '-W\b' such that '-Wall' is not matched.
> 
> No, but you can do
> 
>  if(NOT " ${CMAKE_C_FLAGS} " MATCHES " -W ")
> 
> Note the space on the left side.  That allows the right side
> to match even at the beginning or end.

Yes, but that won't work for the flags at the beginning and end. 

Edge case (hehe) to live with or special cases for those with regexes with 
"^${flag} " and "${flag}$"? Even then "^${flag} " won't match if there's 
only one flag in there (because of the whitespace), so a full function to 
check for existence gets complex to complete.

Thanks,

Steve.





More information about the cmake-developers mailing list