diff options
author | Brad King <brad.king@kitware.com> | 2013-03-19 19:20:30 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-03-19 19:20:30 (GMT) |
commit | b04b8ddfd8c6203c15ec6bf411da49817dec4800 (patch) | |
tree | 412316020079dcb4acee8fc8d4b3cb3d5e5ec7ae /Modules | |
parent | 16695a6d77e48532102f09289cf5a9fad5184df7 (diff) | |
parent | d7e05e4144e36e2e7ad2656aa86ea037677e72b3 (diff) | |
download | CMake-b04b8ddfd8c6203c15ec6bf411da49817dec4800.zip CMake-b04b8ddfd8c6203c15ec6bf411da49817dec4800.tar.gz CMake-b04b8ddfd8c6203c15ec6bf411da49817dec4800.tar.bz2 |
Merge topic 'Ruby-version-selection'
d7e05e4 FindRuby: improve version selection
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindRuby.cmake | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index 119cb63..c02158f 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -46,15 +46,24 @@ set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ruby) # if 1.9 is required, don't look for ruby18 and ruby1.8, default to version 1.8 if(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR) set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}") + # we can't construct that if only major version is given + set(_RUBY_POSSIBLE_EXECUTABLE_NAMES + ruby${Ruby_FIND_VERSION_MAJOR}.${Ruby_FIND_VERSION_MINOR} + ruby${Ruby_FIND_VERSION_MAJOR}${Ruby_FIND_VERSION_MINOR} + ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) else() set(Ruby_FIND_VERSION_SHORT_NODOT "18") endif() -set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.9 ruby19) +if(NOT Ruby_FIND_VERSION_EXACT) + list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.9 ruby19) -# if we want a version below 1.9, also look for ruby 1.8 -if("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19") - set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES} ruby1.8 ruby18) + # if we want a version below 1.9, also look for ruby 1.8 + if("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19") + list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.8 ruby18) + endif() + + list(REMOVE_DUPLICATES _RUBY_POSSIBLE_EXECUTABLE_NAMES) endif() find_program(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) |