[Cmake] Capture regular expressions

Filipe Sousa filipe.gr.sousa at alunos.ipb.pt
Mon, 3 May 2004 14:54:51 +0100


--Boundary-02=_68klA85CtT+onsK
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Monday 03 May 2004 14:19, Brad King wrote:
> Filipe Sousa wrote:
> > I wrote my own FindQt.cmake so that I could find the right qt lib on
> > Windows. I need to extract the version from global.h. I managed that
> > using two STRING command, but I would like to capture version around
> > parentheses with regular expressions using only one STRING command. Is
> > this possible with cmake?
>
> What do you mean by "version around parentheses"?  Code like this is
> supported:
>
> STRING(REGEX REPLACE "#define[\\t\\ ]+QT_VERSION_STR[\\t\\
> ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" "\\1" qt_version "${VERSION_STR}")
>
> Note the "\\1" in the replace expression.  The two backslashes make it
> through argument processing as a single backslash, and then the "\1" is
> replaced by the part of the string matched inside the parentheses.

That's exactly what i've been looking for. I didn't known that i could do t=
hat=20
with STRING(REGEX REPLACE using "\\1". Is this feature well documented?

> -Brad
> _______________________________________________
> Cmake mailing list
> Cmake at www.cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

=2D- Filipe Sousa

--Boundary-02=_68klA85CtT+onsK
Content-Type: application/pgp-signature
Content-Description: signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBAlk86bQdNYqwwwCwRAuggAJwOrDMUl/Fo5aLT1kRFznIRlvkQ2wCfRJ2y
HeAVkXzIlajlTxCR+WDZVzU=
=yREw
-----END PGP SIGNATURE-----

--Boundary-02=_68klA85CtT+onsK--