Cmake 3.11 failed to compile REGEX

Asked

Viewed 51 times

1

I’m trying to set up a library with Cmake 3.11 and I’m getting a build error from a REGEX string, the project asks for FLEX 2.5 with the function find_package:

find_package(FLEX 2.5 REQUIRED)

This call uses the module Findflex.cmake, in line 137 of this module has the instruction that generates the error:

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

The mistake 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)?"? (version )?([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.

1 answer

2


Missing close parenthesis at the end of the line.

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

In the code from Findflex.cmake that line is actually like this:

string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? 
(version )?([0-9]+[^ ]*)( .*)?$" "\\3" FLEX_VERSION "${FLEX_version_output}")
  • the FLEX executable I was using was flex++. exe, when I switched to flex.exe it worked, but it also doesn’t make a difference, I’ve changed the API and already managed to compile, thank you for your attention.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.