summaryrefslogtreecommitdiff
path: root/cmake/FindRuby.cmake
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-11-21 16:38:22 +0100
committerSébastien Helleu <flashcode@flashtux.org>2021-11-21 16:38:22 +0100
commitbe753046b729dab518c390cbf9be6360310fc65a (patch)
tree6e486ded1b949713df169ec951fdbe5b8a5e4893 /cmake/FindRuby.cmake
parent15f5bc794443f3d3348f3f69cb960166b4b4e9b6 (diff)
downloadweechat-be753046b729dab518c390cbf9be6360310fc65a.zip
core: fix detection of Ruby 3.0 on macOS (issue #1721)
Diffstat (limited to 'cmake/FindRuby.cmake')
-rw-r--r--cmake/FindRuby.cmake15
1 files changed, 9 insertions, 6 deletions
diff --git a/cmake/FindRuby.cmake b/cmake/FindRuby.cmake
index e92fbc577..f874453d3 100644
--- a/cmake/FindRuby.cmake
+++ b/cmake/FindRuby.cmake
@@ -33,10 +33,13 @@ endif()
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
- pkg_search_module(RUBY ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ruby-2.4 ruby-2.3 ruby-2.2 ruby-2.1 ruby-2.0 ruby-1.9)
-endif()
-
-if(RUBY_FOUND)
- set(RUBY_LIB "")
- mark_as_advanced(RUBY_LIB)
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # set specific search path for macOS
+ set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/ruby/lib/pkgconfig")
+ endif()
+ pkg_search_module(RUBY ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ruby-2.4 ruby-2.3 ruby-2.2 ruby-2.1 ruby-2.0 ruby-1.9 ruby)
+ if(RUBY_FOUND AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # FIXME: weird hack: hardcoding the Ruby lib location on macOS
+ set(RUBY_LDFLAGS "${RUBY_LDFLAGS} -L/usr/local/opt/ruby/lib")
+ endif()
endif()