[cmake-developers] string SUBSTRING TRUNCATE mode
Rolf Eike Beer
eike at sf-mail.de
Thu Nov 13 13:46:46 EST 2014
Am Donnerstag, 13. November 2014, 13:07:52 schrieben Sie:
> On 11/13/2014 12:48 PM, Rolf Eike Beer wrote:
> > This should be a good addition, no?
> >
> > diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
> > index 56d9b66..66717ef 100644
> > --- a/Modules/CPackRPM.cmake
> > +++ b/Modules/CPackRPM.cmake
> > @@ -683,9 +683,7 @@ foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS
> > PROVIDES OBSOLETES PREFIX CONFLIC>
> > # Transform NAME --> Name e.g. PROVIDES --> Provides
> > # The Upper-case first letter and lowercase tail is the
> > # appropriate value required in the final RPM spec file.
> >
> > - string(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH)
> > - math(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} -
> > 1") - string(SUBSTRING ${_RPM_SPEC_HEADER} 1
> > ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL) + string(SUBSTRING
> > ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL)>
> > string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL)
> > string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
> > set(_PACKAGE_HEADER_NAME
> > "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
>
> Yes, once the main change is in 'master' please add a topic to
> update call sites like this.
This one is actually independent, as the -1 syntax was added by me years back.
And AFAICT this is the only call site inside CMake itself that benefits from
any of the advanced modes of SUBSTRING, there are very few call sites anyway.
Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141113/e61a1033/attachment.sig>
More information about the cmake-developers
mailing list