View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001067CMakepublic2004-08-17 23:562004-08-23 11:40
Reportermtrudeau 
Assigned ToBrad King 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001067: erratic behavior of 'MATCHES'
DescriptionI'm getting a bug from running CMake on wxArt2D.
To illustrate the problem better, I added the following lines to FindExpat.cmake:

IF("EXPAT_HDR_OK3" MATCHES "^EXPAT_HDR_OK3$")
    MESSAGE("match underscore")
ELSE("EXPAT_HDR_OK3" MATCHES "^EXPAT_HDR_OK3$")
    MESSAGE("no match underscore")
ENDIF("EXPAT_HDR_OK3" MATCHES "^EXPAT_HDR_OK3$")

IF("EXPATHDROK3" MATCHES "^EXPATHDROK3$")
    MESSAGE("match block")
ELSE("EXPATHDROK3" MATCHES "^EXPATHDROK3$")
    MESSAGE("no match block")
ENDIF("EXPATHDROK3" MATCHES "^EXPATHDROK3$")

IF("EXPAT-HDR-OK3" MATCHES "^EXPAT-HDR-OK3$")
    MESSAGE("match dash")
ELSE("EXPAT-HDR-OK3" MATCHES "^EXPAT-HDR-OK3$")
    MESSAGE("no match dash")
ENDIF("EXPAT-HDR-OK3" MATCHES "^EXPAT-HDR-OK3$")

These code lines produce different output in different situations, especially when I change
the name of the variable EXPAT_HDR_OK3 to
one of the above.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0001395)
Bill Hoffman (manager)
2004-08-23 11:27

I think this was resolved on the cmake list right?
If so, Brad, can you close this bug?

-Bill
(0001396)
Brad King (manager)
2004-08-23 11:40

This is not a bug. The behavior of the IF command for MATCHES is documented at http://www.cmake.org/HTML/Documentation.html [^] and by "cmake --help-command IF".

The command

  IF(FOO MATCHES BAR)

tests whether the contents of the variable FOO matches the regular expression "BAR". If the variable is not defined then its name is matched against the regular expression. Therefore

  IF(FOO MATCHES "^FOO$")

is a way to test whether the variable FOO is defined (unless it is defined to its own name). This kind of test appears in many places that were written before the DEFINED option was added to the IF command.

 Issue History
Date Modified Username Field Change


Copyright © 2000 - 2018 MantisBT Team