On 29 December 2014 at 19:02, Evangelos Foutras <evange...@foutrelis.com> wrote:
> Since commit 854e762 (FindRuby: clean up querying variables from Ruby)
> we query RbConfig::CONFIG first and, if the command fails or its output
> equates to a false constant, then fall back to querying Config::CONFIG.
>
> Due to the above, an error condition exists with Ruby 2.2.0; when querying
> RbConfig::CONFIG['TEENY'], the output of '0' will be discarded since it
> matches the false constant '0'.
>
> In previous versions this wasn't a problem, but Ruby 2.2 has completely
> removed Config::CONFIG. This causes RUBY_VERSION_PATCH to be set to an
> empty string and the Ruby version to be detected as '2.2.' (instead of
> '2.2.0').
>
> This patch fixes the output check to explicitly look for an empty string
> before using the fallback query method. (Someone more familiar with Ruby
> might be able to deem the fallback as unnecessary and fully remove it.)
> ---
>  Modules/FindRuby.cmake | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
> index b5ac703..0950d15 100644
> --- a/Modules/FindRuby.cmake
> +++ b/Modules/FindRuby.cmake
> @@ -90,7 +90,7 @@ if(RUBY_EXECUTABLE  AND NOT  RUBY_VERSION_MAJOR)
>        RESULT_VARIABLE _RUBY_SUCCESS
>        OUTPUT_VARIABLE _RUBY_OUTPUT
>        ERROR_QUIET)
> -    if(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT)
> +    if(_RUBY_SUCCESS OR _RUBY_OUTPUT STREQUAL "")
>        execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print 
> Config::CONFIG['${RBVAR}']"
>          RESULT_VARIABLE _RUBY_SUCCESS
>          OUTPUT_VARIABLE _RUBY_OUTPUT
> --
> 2.2.1

Could I get some feedback on this please?

Thanks.
-- 

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