Am Freitag, 3. Oktober 2014, 14:34:38 schrieb Brad King:
> On 10/03/2014 12:47 PM, Rolf Eike Beer wrote:
> > +          # give an exact match if the first ${NAME}_FIND_VERSION_COUNT
> > components of the version string match +          # this constructs the
> > equivalent of "(([^.]\\.){${${_NAME}_FIND_VERSION_COUNT}})" +         
> > unset(_VERSION_REGEX)
> > +          # foreach(RANGE) doesn't like it if stop is greater start
> > +          if (${${_NAME}_FIND_VERSION_COUNT} GREATER 1)
> > +            foreach (_NUM RANGE 2 ${${_NAME}_FIND_VERSION_COUNT})
> > +              set(_VERSION_REGEX "${_VERSION_REGEX}[^.]*\\.")
> > +            endforeach ()
> > +          endif ()
> 
> Since _FIND_VERSION_COUNT is always [0-4], I think a hand-coded lookup
> table may be simpler and faster.

Yes.

> > +          string(REGEX REPLACE "^(${_VERSION_REGEX}[^.]*)\\..*" "\\1"
> > _VERSION_HEAD "${VERSION}")
> Perhaps use something like
> 
>  if(VERSION MATCHES "^(${_VERSION_REGEX}[^.]*)\\..*")
>    set(_VERSION_HEAD "${CMAKE_MATCH_1}")
>  else()
>    message(... bad VERSION in call to fphsa...)
>  endif()
> 
> in case something fails to match for some reason.

I counted the number of dots before, so there must be a match.

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to