CMake 3.11 failed to compile REGEX

1

I'm trying to set up a library with CMake 3.11 and I'm getting a compilation error of a REGEX string, the project requests FLEX 2.5 with the function find_package :

find_package(FLEX 2.5 REQUIRED)

This call uses the FindFLEX.cmake module, line 137 of this module has the statement that generates the error:

string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? (version )?([0-9]+[^ ]*)( .*)?$" "\3"

The error is:

  

CMake Error at D: /CMake/share/cmake-3.1/Modules/FindFLEX.cmake: 137 (string):       string sub-command REGEX, mode REPLACE failed to compile regex       "^. flex ++ (.exe)?"? (? 0-9) + [^] ) (. *)? $ ".       Call Stack (most recent call first):

     

CMakeLists.txt: 58 (find_package)

The FLEX 2.5 directory has already been configured.

Thank you for your attention.

    
asked by anonymous 01.02.2015 / 16:54

1 answer

2

You have missed closing the parenthesis at the end of the line.

string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? 
(version )?([0-9]+[^ ]*)( .*)?$" "\3")

In the code of FindFLEX.cmake this line actually looks like this:

string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? 
(version )?([0-9]+[^ ]*)( .*)?$" "\3" FLEX_VERSION "${FLEX_version_output}")
    
01.02.2015 / 18:07