mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 13:26:38 +02:00
python: fix archaic and soft-deprecated use of raw cmake vars
In commit9a9a262ea1we moved from pkg-config to find_package() to work around a deficiency in the pkgsrc package manager, which does not ship pkg-config files as intended by CPython. Modern CMake discourages use of "FOO_LIBRARIES" in all cases, when imported "interface" libraries can and should be used instead. The meson equivalent is `dependency()` versus `cc.find_library()`, so this is certainly a general trend among modern build systems. An imported interface target, such as the previous PkgConfig::PYTHON, carries with it the various internal properties such as DEFINITIONS, INCLUDE_DIRS, or LIBRARIES, and batch applies them. It also avoids leaking across cmake 2.x style whole-directory scopes. Use the documented cmake imported interface target for embedding Python and avoid `add_definitions(${Python_DEFINITIONS})` and similar. As a bonus, it's also shorter and more concise. Fixes:9a9a262ea1Fixes: https://github.com/weechat/weechat/pull/2251 Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
This commit is contained in:
committed by
Sébastien Helleu
parent
4c79e870af
commit
0bbae498c9
@@ -31,8 +31,8 @@ add_library(python MODULE
|
||||
)
|
||||
set_target_properties(python PROPERTIES PREFIX "")
|
||||
|
||||
include_directories(${Python_INCLUDE_DIRS})
|
||||
add_definitions(${Python_DEFINITIONS})
|
||||
target_link_libraries(python ${Python_LIBRARIES} weechat_plugins_scripts coverage_config)
|
||||
if(Python_FOUND)
|
||||
target_link_libraries(python Python::Python weechat_plugins_scripts coverage_config)
|
||||
endif()
|
||||
|
||||
install(TARGETS python LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
|
||||
|
||||
Reference in New Issue
Block a user