mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
cmake: plugins: simplify dependency handling
Move the requirement checks within the respective plugin cmakefile. Use REQUIRED instead of the manual FOUND check and error handling. Note: the tcl check was only moved, since using REQUIRED explodes in CI. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
committed by
Sébastien Helleu
parent
440907e1cd
commit
a413d16038
+10
-72
@@ -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()
|
||||
|
||||
@@ -19,18 +19,20 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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()
|
||||
|
||||
@@ -19,17 +19,15 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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")
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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")
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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")
|
||||
|
||||
@@ -19,31 +19,31 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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")
|
||||
|
||||
@@ -19,16 +19,16 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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")
|
||||
|
||||
@@ -19,16 +19,20 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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")
|
||||
|
||||
@@ -19,19 +19,19 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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")
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
@@ -21,16 +21,19 @@
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user