diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 4ae3323bb..f97c69129 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -58,11 +58,7 @@ else()
endif()
if(ENABLE_CHARSET)
- if(ICONV_FOUND)
- add_subdirectory(charset)
- else()
- message(SEND_ERROR "Iconv not found")
- endif()
+ add_subdirectory(charset)
else()
add_custom_target(charset COMMAND true)
endif()
@@ -110,113 +106,55 @@ else()
endif()
if(ENABLE_SCRIPTS AND ENABLE_PERL)
- find_package(Perl)
- if(PERL_FOUND)
- add_subdirectory(perl)
- else()
- message(SEND_ERROR "Perl not found")
- endif()
+ add_subdirectory(perl)
else()
add_custom_target(perl COMMAND true)
endif()
if(ENABLE_SCRIPTS AND ENABLE_PYTHON)
- if(CMAKE_VERSION VERSION_LESS "3.18.0")
- find_package(Python 3.0 COMPONENTS Development)
- else()
- find_package(Python 3.0 COMPONENTS Development.Embed)
- endif()
- if(Python_FOUND)
- add_subdirectory(python)
- else()
- message(SEND_ERROR "Python not found")
- endif()
+ add_subdirectory(python)
else()
add_custom_target(python COMMAND true)
endif()
if(ENABLE_SCRIPTS AND ENABLE_RUBY)
- find_package(Ruby)
- if(RUBY_FOUND)
- add_subdirectory(ruby)
- else()
- message(SEND_ERROR "Ruby not found")
- endif()
+ add_subdirectory(ruby)
else()
add_custom_target(ruby COMMAND true)
endif()
if(ENABLE_SCRIPTS AND ENABLE_LUA)
- find_package(Lua)
- if(LUA_FOUND)
- add_subdirectory(lua)
- else()
- message(SEND_ERROR "Lua not found")
- endif()
+ add_subdirectory(lua)
else()
add_custom_target(lua COMMAND true)
endif()
if(ENABLE_SCRIPTS AND ENABLE_TCL)
- find_package(TCL)
- if(TCL_FOUND)
- add_subdirectory(tcl)
- else()
- message(SEND_ERROR "Tcl not found")
- endif()
+ add_subdirectory(tcl)
else()
add_custom_target(tcl COMMAND true)
endif()
if(ENABLE_SCRIPTS AND ENABLE_GUILE)
- find_package(Guile)
- if(GUILE_FOUND)
- add_subdirectory(guile)
- else()
- message(SEND_ERROR "Guile not found")
- endif()
+ add_subdirectory(guile)
else()
add_custom_target(guile COMMAND true)
endif()
if(ENABLE_SCRIPTS AND ENABLE_JAVASCRIPT)
- find_package(V8)
- if(V8_FOUND)
- add_subdirectory(javascript)
- else()
- message(SEND_ERROR "V8 (javascript) not found")
- endif()
+ add_subdirectory(javascript)
else()
add_custom_target(javascript COMMAND true)
endif()
if(ENABLE_SCRIPTS AND ENABLE_PHP)
- find_package(PHP)
- if(PHP_FOUND)
- add_subdirectory(php)
- else()
- message(SEND_ERROR "Php not found")
- endif()
+ add_subdirectory(php)
else()
add_custom_target(php COMMAND true)
endif()
if(ENABLE_SPELL)
- if(ENABLE_ENCHANT)
- pkg_check_modules(ENCHANT enchant-2)
- if(ENCHANT_FOUND)
- add_subdirectory(spell)
- else()
- message(SEND_ERROR "Enchant not found")
- endif()
- else()
- find_package(Aspell)
- if(ASPELL_FOUND)
- add_subdirectory(spell)
- else()
- message(SEND_ERROR "Aspell not found")
- endif()
- endif()
+ add_subdirectory(spell)
else()
add_custom_target(spell COMMAND true)
endif()
diff --git a/src/plugins/charset/CMakeLists.txt b/src/plugins/charset/CMakeLists.txt
index 7c918223c..557807637 100644
--- a/src/plugins/charset/CMakeLists.txt
+++ b/src/plugins/charset/CMakeLists.txt
@@ -19,18 +19,20 @@
# along with WeeChat. If not, see .
#
-add_library(charset MODULE
- charset.c charset.h
-)
-set_target_properties(charset PROPERTIES PREFIX "")
-
if(ICONV_FOUND)
+ add_library(charset MODULE
+ charset.c charset.h
+ )
+ set_target_properties(charset PROPERTIES PREFIX "")
+
include_directories(${ICONV_INCLUDE_PATH})
if(ICONV_LIBRARY)
target_link_libraries(charset ${ICONV_LIBRARY} coverage_config)
else()
target_link_libraries(charset coverage_config)
endif()
-endif()
-install(TARGETS charset LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
+ install(TARGETS charset LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
+else()
+ message(SEND_ERROR "Iconv not found")
+endif()
diff --git a/src/plugins/guile/CMakeLists.txt b/src/plugins/guile/CMakeLists.txt
index 773600a07..ae67a6b62 100644
--- a/src/plugins/guile/CMakeLists.txt
+++ b/src/plugins/guile/CMakeLists.txt
@@ -19,17 +19,15 @@
# along with WeeChat. If not, see .
#
+find_package(Guile REQUIRED)
+
add_library(guile MODULE
weechat-guile.c weechat-guile.h
weechat-guile-api.c weechat-guile-api.h
)
set_target_properties(guile PROPERTIES PREFIX "")
-if(GUILE_FOUND)
- include_directories(${GUILE_INCLUDE_DIRS})
- set(LINK_LIBS)
- list(APPEND LINK_LIBS ${GUILE_LDFLAGS})
- target_link_libraries(guile ${LINK_LIBS} weechat_plugins_scripts coverage_config)
-endif()
+include_directories(${GUILE_INCLUDE_DIRS})
+target_link_libraries(guile ${GUILE_LDFLAGS} weechat_plugins_scripts coverage_config)
install(TARGETS guile LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
diff --git a/src/plugins/javascript/CMakeLists.txt b/src/plugins/javascript/CMakeLists.txt
index 3dbc4a0a5..6acea675a 100644
--- a/src/plugins/javascript/CMakeLists.txt
+++ b/src/plugins/javascript/CMakeLists.txt
@@ -19,6 +19,8 @@
# along with WeeChat. If not, see .
#
+find_package(V8 REQUIRED)
+
enable_language(CXX)
add_library(javascript MODULE
@@ -28,9 +30,7 @@ add_library(javascript MODULE
)
set_target_properties(javascript PROPERTIES PREFIX "")
-if(V8_FOUND)
- include_directories(${V8_INCLUDE_DIR})
- target_link_libraries(javascript ${V8_LIBRARY} weechat_plugins_scripts coverage_config)
-endif()
+include_directories(${V8_INCLUDE_DIR})
+target_link_libraries(javascript ${V8_LIBRARY} weechat_plugins_scripts coverage_config)
install(TARGETS javascript LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
diff --git a/src/plugins/lua/CMakeLists.txt b/src/plugins/lua/CMakeLists.txt
index e67930867..e166d14c8 100644
--- a/src/plugins/lua/CMakeLists.txt
+++ b/src/plugins/lua/CMakeLists.txt
@@ -20,16 +20,16 @@
# along with WeeChat. If not, see .
#
+find_package(Lua REQUIRED)
+
add_library(lua MODULE
weechat-lua.c weechat-lua.h
weechat-lua-api.c weechat-lua-api.h
)
set_target_properties(lua PROPERTIES PREFIX "")
-if(LUA_FOUND)
- add_definitions(${LUA_CFLAGS})
- include_directories(${LUA_INCLUDE_DIRS})
- target_link_libraries(lua ${LUA_LDFLAGS} weechat_plugins_scripts coverage_config)
-endif()
+add_definitions(${LUA_CFLAGS})
+include_directories(${LUA_INCLUDE_DIRS})
+target_link_libraries(lua ${LUA_LDFLAGS} weechat_plugins_scripts coverage_config)
install(TARGETS lua LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
diff --git a/src/plugins/perl/CMakeLists.txt b/src/plugins/perl/CMakeLists.txt
index e844d9d76..2dacece7e 100644
--- a/src/plugins/perl/CMakeLists.txt
+++ b/src/plugins/perl/CMakeLists.txt
@@ -19,31 +19,31 @@
# along with WeeChat. If not, see .
#
+find_package(Perl REQUIRED)
+
add_library(perl MODULE
weechat-perl.c weechat-perl.h
weechat-perl-api.c weechat-perl-api.h
)
set_target_properties(perl PROPERTIES PREFIX "")
-if(PERL_FOUND)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- # remove "-arch xxx" on macOS
- string(REGEX REPLACE "-arch ppc|-arch i386|-arch x86_64" "" PERL_CFLAGS "${PERL_CFLAGS}")
- string(REGEX REPLACE "-arch ppc|-arch i386|-arch x86_64" "" PERL_LFLAGS "${PERL_LFLAGS}")
- endif()
- add_definitions(${PERL_CFLAGS})
- include_directories(${PERL_INCLUDE_PATH})
- # ugly hack to force linking against Dynaloader.a
- string(REGEX MATCH "/[^ $]*/DynaLoader.a" PERL_DYNALOADER "${PERL_LFLAGS}")
- if(PERL_DYNALOADER)
- string(REPLACE "${PERL_DYNALOADER}" "" PERL_LFLAGS "${PERL_LFLAGS}")
- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
- execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PERL_DYNALOADER} ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
- target_link_libraries(perl ${PERL_LIBRARY} weechat_plugins_scripts ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a coverage_config)
- else()
- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
- target_link_libraries(perl ${PERL_LIBRARY} weechat_plugins_scripts coverage_config)
- endif()
+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # remove "-arch xxx" on macOS
+ string(REGEX REPLACE "-arch ppc|-arch i386|-arch x86_64" "" PERL_CFLAGS "${PERL_CFLAGS}")
+ string(REGEX REPLACE "-arch ppc|-arch i386|-arch x86_64" "" PERL_LFLAGS "${PERL_LFLAGS}")
+endif()
+add_definitions(${PERL_CFLAGS})
+include_directories(${PERL_INCLUDE_PATH})
+# ugly hack to force linking against Dynaloader.a
+string(REGEX MATCH "/[^ $]*/DynaLoader.a" PERL_DYNALOADER "${PERL_LFLAGS}")
+if(PERL_DYNALOADER)
+ string(REPLACE "${PERL_DYNALOADER}" "" PERL_LFLAGS "${PERL_LFLAGS}")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PERL_DYNALOADER} ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
+ target_link_libraries(perl ${PERL_LIBRARY} weechat_plugins_scripts ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a coverage_config)
+else()
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
+ target_link_libraries(perl ${PERL_LIBRARY} weechat_plugins_scripts coverage_config)
endif()
install(TARGETS perl LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
diff --git a/src/plugins/php/CMakeLists.txt b/src/plugins/php/CMakeLists.txt
index 64501d6b4..eb2586620 100644
--- a/src/plugins/php/CMakeLists.txt
+++ b/src/plugins/php/CMakeLists.txt
@@ -19,16 +19,16 @@
# along with WeeChat. If not, see .
#
+find_package(PHP REQUIRED)
+
add_library(php MODULE
weechat-php.c weechat-php.h
weechat-php-api.c weechat-php-api.h
)
set_target_properties(php PROPERTIES PREFIX "")
-if(PHP_FOUND)
- include_directories(${PHP_INCLUDE_DIRS})
- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PHP_LDFLAGS}")
- target_link_libraries(php ${PHP_LIB} weechat_plugins_scripts coverage_config)
-endif()
+include_directories(${PHP_INCLUDE_DIRS})
+set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PHP_LDFLAGS}")
+target_link_libraries(php ${PHP_LIB} weechat_plugins_scripts coverage_config)
install(TARGETS php LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
diff --git a/src/plugins/python/CMakeLists.txt b/src/plugins/python/CMakeLists.txt
index 1e1bfc6e2..e45e3e426 100644
--- a/src/plugins/python/CMakeLists.txt
+++ b/src/plugins/python/CMakeLists.txt
@@ -19,16 +19,20 @@
# along with WeeChat. If not, see .
#
+if(CMAKE_VERSION VERSION_LESS "3.18.0")
+ find_package(Python 3.0 REQUIRED COMPONENTS Development)
+else()
+ find_package(Python 3.0 REQUIRED COMPONENTS Development.Embed)
+endif()
+
add_library(python MODULE
weechat-python.c weechat-python.h
weechat-python-api.c weechat-python-api.h
)
set_target_properties(python PROPERTIES PREFIX "")
-if(Python_FOUND)
- include_directories(${Python_INCLUDE_DIRS})
- add_definitions(${Python_DEFINITIONS})
- target_link_libraries(python ${Python_LIBRARIES} weechat_plugins_scripts coverage_config)
-endif()
+include_directories(${Python_INCLUDE_DIRS})
+add_definitions(${Python_DEFINITIONS})
+target_link_libraries(python ${Python_LIBRARIES} weechat_plugins_scripts coverage_config)
install(TARGETS python LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
diff --git a/src/plugins/ruby/CMakeLists.txt b/src/plugins/ruby/CMakeLists.txt
index f91db80be..fe72c7c56 100644
--- a/src/plugins/ruby/CMakeLists.txt
+++ b/src/plugins/ruby/CMakeLists.txt
@@ -19,19 +19,19 @@
# along with WeeChat. If not, see .
#
+find_package(Ruby REQUIRED)
+
add_library(ruby MODULE
weechat-ruby.c weechat-ruby.h
weechat-ruby-api.c weechat-ruby-api.h
)
set_target_properties(ruby PROPERTIES PREFIX "")
-if(RUBY_FOUND)
- # temporary fix: ignore all warnings on unused parameters due to warnings
- # caused by Ruby headers (with Ruby ≥ 3.1.0)
- # see: https://github.com/ruby/ruby/pull/7085
- add_definitions(-Wno-unused-parameter)
- include_directories(${Ruby_INCLUDE_DIRS})
- target_link_libraries(ruby ${Ruby_LIBRARIES} weechat_plugins_scripts coverage_config)
-endif(RUBY_FOUND)
+# temporary fix: ignore all warnings on unused parameters due to warnings
+# caused by Ruby headers (with Ruby ≥ 3.1.0)
+# see: https://github.com/ruby/ruby/pull/7085
+add_definitions(-Wno-unused-parameter)
+include_directories(${Ruby_INCLUDE_DIRS})
+target_link_libraries(ruby ${Ruby_LIBRARIES} weechat_plugins_scripts coverage_config)
install(TARGETS ruby LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
diff --git a/src/plugins/spell/CMakeLists.txt b/src/plugins/spell/CMakeLists.txt
index 199e9c2b3..a35f02fd2 100644
--- a/src/plugins/spell/CMakeLists.txt
+++ b/src/plugins/spell/CMakeLists.txt
@@ -20,6 +20,12 @@
# along with WeeChat. If not, see .
#
+if(ENABLE_ENCHANT)
+ pkg_check_modules(ENCHANT REQUIRED enchant-2)
+else()
+ find_package(Aspell REQUIRED)
+endif()
+
add_library(spell MODULE
spell.c spell.h
spell-bar-item.c spell-bar-item.h
diff --git a/src/plugins/tcl/CMakeLists.txt b/src/plugins/tcl/CMakeLists.txt
index d5932e207..d394a2696 100644
--- a/src/plugins/tcl/CMakeLists.txt
+++ b/src/plugins/tcl/CMakeLists.txt
@@ -21,16 +21,19 @@
# along with WeeChat. If not, see .
#
-add_library(tcl MODULE
- weechat-tcl.c weechat-tcl.h
- weechat-tcl-api.c weechat-tcl-api.h
-)
-set_target_properties(tcl PROPERTIES PREFIX "")
-
+find_package(TCL)
if(TCL_FOUND)
+ add_library(tcl MODULE
+ weechat-tcl.c weechat-tcl.h
+ weechat-tcl-api.c weechat-tcl-api.h
+ )
+ set_target_properties(tcl PROPERTIES PREFIX "")
+
include_directories(${TCL_INCLUDE_PATH})
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${TCL_LFLAGS}")
target_link_libraries(tcl ${TCL_LIBRARY} weechat_plugins_scripts coverage_config)
-endif()
-install(TARGETS tcl LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
+ install(TARGETS tcl LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
+else()
+ message(SEND_ERROR "Tcl not found")
+endif()
diff --git a/tools/debian/patches/weechat_ubuntu_focal.patch b/tools/debian/patches/weechat_ubuntu_focal.patch
index 60e914c11..7de5d0ae9 100644
--- a/tools/debian/patches/weechat_ubuntu_focal.patch
+++ b/tools/debian/patches/weechat_ubuntu_focal.patch
@@ -36,17 +36,16 @@ index 086056f76..559ccfffb 100755
-DENABLE_MAN:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
diff --git a/src/plugins/ruby/CMakeLists.txt b/src/plugins/ruby/CMakeLists.txt
-index 9f921fde8..2860f7d6d 100644
+index fe72c7c56..1fb293512 100644
--- a/src/plugins/ruby/CMakeLists.txt
+++ b/src/plugins/ruby/CMakeLists.txt
-@@ -28,8 +28,8 @@ if(RUBY_FOUND)
- # caused by Ruby headers (with Ruby ≥ 3.1.0)
- # see: https://github.com/ruby/ruby/pull/7085
- add_definitions(-Wno-unused-parameter)
-- include_directories(${Ruby_INCLUDE_DIRS})
-- target_link_libraries(ruby ${Ruby_LIBRARIES} weechat_plugins_scripts coverage_config)
-+ include_directories(${RUBY_INCLUDE_DIRS})
-+ target_link_libraries(ruby ${RUBY_LIBRARY} weechat_plugins_scripts coverage_config)
- endif(RUBY_FOUND)
+@@ -31,7 +31,7 @@ set_target_properties(ruby PROPERTIES PREFIX "")
+ # caused by Ruby headers (with Ruby ≥ 3.1.0)
+ # see: https://github.com/ruby/ruby/pull/7085
+ add_definitions(-Wno-unused-parameter)
+-include_directories(${Ruby_INCLUDE_DIRS})
+-target_link_libraries(ruby ${Ruby_LIBRARIES} weechat_plugins_scripts coverage_config)
++include_directories(${RUBY_INCLUDE_DIRS})
++target_link_libraries(ruby ${RUBY_LIBRARY} weechat_plugins_scripts coverage_config)
install(TARGETS ruby LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")