summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-02-01 19:46:15 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-02-01 19:46:15 (GMT)
commitb7fd02422985cf4bf4e2ab2676b08fcbbf6ffdc9 (patch)
treed75a5771c7fa1c99b8e93eb2f5a8ca914dd91973
parentbbc7259f703566cef831b78d8616546bfe9c9d97 (diff)
parent409aeafa2518a1cd38709810ba765860ef21aeb8 (diff)
downloadCMake-b7fd02422985cf4bf4e2ab2676b08fcbbf6ffdc9.zip
CMake-b7fd02422985cf4bf4e2ab2676b08fcbbf6ffdc9.tar.gz
CMake-b7fd02422985cf4bf4e2ab2676b08fcbbf6ffdc9.tar.bz2
Merge topic 'findruby-no-dummy-version'
409aeaf FindRuby: do not blindly set version to 1.8.0
-rw-r--r--Modules/FindRuby.cmake19
1 files changed, 10 insertions, 9 deletions
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index 5d6c98a..c4adfd1 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -139,7 +139,7 @@ ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
# In case RUBY_EXECUTABLE could not be executed (e.g. cross compiling)
# try to detect which version we found. This is not too good.
-IF(NOT RUBY_VERSION_MAJOR)
+IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
# by default assume 1.8.0
SET(RUBY_VERSION_MAJOR 1)
SET(RUBY_VERSION_MINOR 8)
@@ -149,13 +149,14 @@ IF(NOT RUBY_VERSION_MAJOR)
SET(RUBY_VERSION_MAJOR 1)
SET(RUBY_VERSION_MINOR 9)
ENDIF(${RUBY_EXECUTABLE} MATCHES "ruby1.?9" OR RUBY_HDR_DIR)
-ENDIF(NOT RUBY_VERSION_MAJOR)
+ENDIF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
-
-SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
-SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}")
-SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}")
-SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}")
+IF(RUBY_VERSION_MAJOR)
+ SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
+ SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}")
+ SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}")
+ SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}")
+ENDIF(RUBY_VERSION_MAJOR)
FIND_PATH(RUBY_INCLUDE_DIR
NAMES ruby.h
@@ -167,7 +168,7 @@ FIND_PATH(RUBY_INCLUDE_DIR
SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} )
# if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir
-IF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR)
+IF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR)
FIND_PATH(RUBY_CONFIG_INCLUDE_DIR
NAMES ruby/config.h config.h
HINTS
@@ -176,7 +177,7 @@ IF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT
)
SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} )
-ENDIF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR)
+ENDIF( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR)
# Determine the list of possible names for the ruby library