[CMake] Re: dangerous regex in CHECK_C_SOURCE_COMPILES

Bill Hoffman bill.hoffman at kitware.com
Tue Nov 13 15:35:42 EST 2007


Brandon Van Every wrote:
> I see the same construct in CHECK_INCLUDE_FILES.  What is the intent?
> This is not safe.
> 
> Cheers,
> Brandon Van Every
> 
> 
> On Nov 7, 2007 11:38 AM, Brandon Van Every <bvanevery at gmail.com> wrote:
>> It begins with:
>>
>> MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
>>   IF("${VAR}" MATCHES "^${VAR}$")
>>
>> What is the intent here?  If ${VAR} contains regex special characters
>> you're going to get all kinds of weird and nasty behavior.
>>

It is checking to see if the variable has been set, from before DEFINED 
was added to if.  However, I don't see the problem.  This is the 
argument to a macro that is supposed to be a valid variable name.  A 
variable name should not contain special characters anyway.

-Bill


More information about the CMake mailing list