Browse Source

FindRuby: Update MSVC runtime library selection

Use the `MSVC_TOOLSET_VERSION` variable computed by CMake to get the
matching Ruby library name component.

Inspired-by: Julien Marrec <[email protected]>
Brad King 5 years ago
parent
commit
675eaf3bd0
1 changed files with 4 additions and 15 deletions
  1. 4 15
      Modules/FindRuby.cmake

+ 4 - 15
Modules/FindRuby.cmake

@@ -242,21 +242,10 @@ endif()
 set(_Ruby_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_Ruby_VERSION_SHORT} ruby${_Ruby_VERSION_SHORT_NODOT} ruby-${_Ruby_VERSION_SHORT} ruby-${Ruby_VERSION})
 
 if(WIN32)
-  set( _Ruby_MSVC_RUNTIME "" )
-  if( MSVC_VERSION EQUAL 1200 )
-    set( _Ruby_MSVC_RUNTIME "60" )
-  endif()
-  if( MSVC_VERSION EQUAL 1300 )
-    set( _Ruby_MSVC_RUNTIME "70" )
-  endif()
-  if( MSVC_VERSION EQUAL 1310 )
-    set( _Ruby_MSVC_RUNTIME "71" )
-  endif()
-  if( MSVC_VERSION EQUAL 1400 )
-    set( _Ruby_MSVC_RUNTIME "80" )
-  endif()
-  if( MSVC_VERSION EQUAL 1500 )
-    set( _Ruby_MSVC_RUNTIME "90" )
+  if(MSVC_TOOLSET_VERSION)
+    set(_Ruby_MSVC_RUNTIME "${MSVC_TOOLSET_VERSION}")
+  else()
+    set(_Ruby_MSVC_RUNTIME "")
   endif()
 
   set(_Ruby_ARCH_PREFIX "")