[CMake] cmake "Regular expression "*Windows.*" cannot compile

David Cole david.cole at kitware.com
Tue May 6 09:17:50 EDT 2008


Because the * follows nothing (as indicated by the very first error message
given.... always fix the first error first)

RegularExpression::compile(): ?+* follows nothing.

* means "zero or more of the preceding character" in a regular expression.
If there is no preceding character it is not a well formed regular
expression. (It *is* a file GLOB expression, but you have to use ".*" to
match "anything" preceding the Windows in a regex...)


HTH,
David



On Mon, May 5, 2008 at 8:39 PM, Phil Pellouchoud <Phil at slacker.com> wrote:

>  Why does this:
>
> SET( PLATFORM_FILTER *Windows.* )
>
>
>
> FOREACH(INP ${PLATFORM_FILTER})
>
>   MESSAGE( "INP=" ${INP} )
>
>   IF("abc_Windows.cpp" MATCHES "${INP}" )
>
>     MESSAGE( "found a match!" )
>
>   ENDIF("abc_Windows.cpp" MATCHES "${INP}" )
>
> ENDFOREACH(INP ${PLATFORM_FILTER})
>
>
>
> Produce this:
>
> S:\software\foo\build> cmake ..
>
> -- Check for working C compiler: cl
>
> -- Check for working C compiler: cl -- works
>
> -- Check size of void*
>
> -- Check size of void* - done
>
> -- Check for working CXX compiler: cl
>
> -- Check for working CXX compiler: cl -- works
>
> INP=*Windows.*
>
> RegularExpression::compile(): ?+* follows nothing.
>
> RegularExpression::compile(): Error in compile.
>
> CMake Error: Error in cmake code at
>
> S:/software/data/cmake/allfiles2.cmake:11:
>
> IF had incorrect arguments: "abc_Windows.cpp" MATCHES "${INP}" (Regular
> expression "*Windows.*" cannot compile).
>
> Current CMake stack:
>
> [2]     S:/software/data/cmake/allfiles2.cmake
>
> [1]     S:/software/foo/CMakeLists.txt
>
> found a match!
>
> -- Configuring done
>
>
>
> S:\software\foo\build>
>
>
>
> I have tried all kinds of variations with regards to using quotes around
> different parts, and I can't get it to compile cleanly.
>
>
>
> -phil
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080506/fad28290/attachment.htm>


More information about the CMake mailing list