[CMake] Strip a prefix from a string
Alexander Neundorf
a.neundorf-work at gmx.net
Sat Jan 10 07:10:02 EST 2009
On Saturday 10 January 2009, Robert Dailey wrote:
> Hi,
>
> Suppose I have a string called "foobar". I want to be able to strip a
> specific prefix from that string and have the suffix returned to me. So if
> I wanted to strip "foo", I would get "bar" back. What's the easiest way of
> doing this in CMake?
You could do e.g.
if ("${YOUR_STRING}" MATCHES "^(foo)(.+)$")
set(YOUR_SUFFIX "${CMAKE_MATCH_2}")
endif ("${YOUR_STRING}" MATCHES "^(foo)(.+)$")
Alex
More information about the CMake
mailing list