From c74e0bdaf66d61c0150a7ca9ec5a2dbcf5cfcc43 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Sun, 23 Mar 2014 23:11:59 -0600 Subject: [PATCH] Use cmake VERSION_ comparison instead of REGEX Also assume that any RUBY version greater than 1.9 functions like 1.9 --- cmake/RubyExtensions.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmake/RubyExtensions.cmake b/cmake/RubyExtensions.cmake index 09ad0dbb..209da5df 100644 --- a/cmake/RubyExtensions.cmake +++ b/cmake/RubyExtensions.cmake @@ -23,8 +23,6 @@ ELSEIF(NOT RUBY_EXTENSIONS_AVAILABLE) EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts RUBY_VERSION" OUTPUT_VARIABLE RUBY_VERSION) STRING(REPLACE "\n" "" RUBY_VERSION ${RUBY_VERSION}) - STRING(REGEX MATCH "^1\\.9" RUBY_19 ${RUBY_VERSION}) - STRING(REGEX MATCH "^1\\.9\\.1" RUBY_191 ${RUBY_VERSION}) message(STATUS "using Ruby version ${RUBY_VERSION}") EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG['CFLAGS']" @@ -37,9 +35,9 @@ ELSEIF(NOT RUBY_EXTENSIONS_AVAILABLE) GET_FILENAME_COMPONENT(rubylib_path ${rubylib_path} PATH) LINK_DIRECTORIES(${rubylib_path}) - if (RUBY_191) + if (RUBY_VERSION VERSION_EQUAL "1.9.1") add_definitions(-DRUBY_191) - elseif (RUBY_19) + elseif (NOT RUBY_VERSION VERSION_LESS "1.9") add_definitions(-DRUBY_19) endif()