Browse Source

FindRuby: Fix match of '.' in version numbers

Escape `.` so that it is matched literally and not treated as a
special match of any character by the regex.
Brad King 8 years ago
parent
commit
23ab451a13
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Modules/FindRuby.cmake

+ 3 - 3
Modules/FindRuby.cmake

@@ -156,17 +156,17 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
    set(RUBY_VERSION_MINOR 8)
    set(RUBY_VERSION_PATCH 0)
    # check whether we found 1.9.x
-   if(${RUBY_EXECUTABLE} MATCHES "ruby1.?9")
+   if(${RUBY_EXECUTABLE} MATCHES "ruby1\\.?9")
       set(RUBY_VERSION_MAJOR 1)
       set(RUBY_VERSION_MINOR 9)
    endif()
    # check whether we found 2.0.x
-   if(${RUBY_EXECUTABLE} MATCHES "ruby2.?0")
+   if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?0")
       set(RUBY_VERSION_MAJOR 2)
       set(RUBY_VERSION_MINOR 0)
    endif()
    # check whether we found 2.1.x
-   if(${RUBY_EXECUTABLE} MATCHES "ruby2.?1")
+   if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?1")
       set(RUBY_VERSION_MAJOR 2)
       set(RUBY_VERSION_MINOR 1)
    endif()