summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/FindRuby.cmake15
-rw-r--r--src/plugins/ruby/CMakeLists.txt4
2 files changed, 10 insertions, 9 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()
diff --git a/src/plugins/ruby/CMakeLists.txt b/src/plugins/ruby/CMakeLists.txt
index 957dd93c6..7ba3b0d8e 100644
--- a/src/plugins/ruby/CMakeLists.txt
+++ b/src/plugins/ruby/CMakeLists.txt
@@ -25,9 +25,7 @@ set_target_properties(ruby PROPERTIES PREFIX "")
if(RUBY_FOUND)
include_directories(${RUBY_INCLUDE_DIRS})
- set(LINK_LIBS)
- list(APPEND LINK_LIBS ${RUBY_LDFLAGS})
- target_link_libraries(ruby ${LINK_LIBS} ${RUBY_LIB} weechat_plugins_scripts coverage_config)
+ target_link_libraries(ruby ${RUBY_LDFLAGS} weechat_plugins_scripts coverage_config)
endif(RUBY_FOUND)
install(TARGETS ruby LIBRARY DESTINATION ${WEECHAT_LIBDIR}/plugins)