vitaut
vitaut

Reputation: 55524

CMake: what is the purpose of matching a variable against itself?

I saw the following piece of CMake code in the definition of the CHECK_C_SOURCE_COMPILES macro:

IF("${VAR}" MATCHES "^${VAR}$")
...

What is the purpose of this code and wouldn't it always succeed?

Upvotes: 4

Views: 100

Answers (1)

Sergei Nikulov
Sergei Nikulov

Reputation: 5110

from CMake mailing list

this is definitely not always true. The variable your are testing may contain "un-evaluated" var or some special regex character( *, ?, ...)

Upvotes: 3

Related Questions