[CMake] Using regex in find_program
Bill Hoffman
bill.hoffman at kitware.com
Tue Dec 18 10:53:00 EST 2007
Rodolfo Schulz de Lima wrote:
> There's a functionality that I'm missing in find_program(...). I must
> find an executable that matches a regex expression.
>
> What I'm trying to achieve is find the name of a cross-compiler. It
> would be mingw32-gcc, i585-mingw32msvc-gcc, etc... so I would match
> ".*mingw32.*-gcc". Is there any other way to do this?
>
> Is it possible to extend find_program to cope with regexes? In my
> example, I would write:
>
> find_program(PROG REGEX ".*mingw32.*-gcc")
>
> The first matching program name (along with its path) would be returned.
> If there's enough consensus that this should be implemented, I'm willing
> to do this...
>
find_program(PROG NAMES name1 name2 name3)
You have to list all the names explicitly, but you can have as many as
you want.
-Bill
More information about the CMake
mailing list