I'm afraid this accidentally went through once already while I was in
the midst of editing it; this time it's for real.

> 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?

I would try something like this:

STRING(REGEX REPLACE "^foo" "" VAR_WITHOUT_FOO ${VAR_WITH_FOO})

Then if ${VAR_WITH_FOO} is "foobar", this will set
${VAR_WITHOUT_FOO} to "bar".

(I've been using a similar device, except that in my case I'm
stripping stuff from the end of the string.)

-- David


_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to