diff --git a/cmake/FindPython.cmake b/cmake/FindPython.cmake index dd961c686..e6023dbc9 100644 --- a/cmake/FindPython.cmake +++ b/cmake/FindPython.cmake @@ -31,7 +31,7 @@ include(FindPkgConfig) if(ENABLE_PYTHON2) - pkg_check_modules(PYTHON python2) + pkg_check_modules(PYTHON python2 IMPORTED_TARGET GLOBAL) else() - pkg_check_modules(PYTHON python3) + pkg_check_modules(PYTHON python3 IMPORTED_TARGET GLOBAL) endif() diff --git a/src/plugins/python/CMakeLists.txt b/src/plugins/python/CMakeLists.txt index 754a89c4e..64a6d6194 100644 --- a/src/plugins/python/CMakeLists.txt +++ b/src/plugins/python/CMakeLists.txt @@ -24,14 +24,7 @@ add_library(python MODULE set_target_properties(python PROPERTIES PREFIX "") if(PYTHON_FOUND) - # There's a weird bug on FreeBSD: the value of PYTHON_LDFLAGS is - # "-L/usr/local/lib;-lpython3.6m" instead of "-L/usr/local/lib -lpython3.6m". - # This is a temporary hack to fix the value, waiting for a clean fix. - string(REPLACE ";" " " PYTHON_LDFLAGS "${PYTHON_LDFLAGS}") - - include_directories(${PYTHON_INCLUDE_DIRS}) - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PYTHON_LDFLAGS}") - target_link_libraries(python ${PYTHON_LIBRARIES} weechat_plugins_scripts coverage_config) + target_link_libraries(python PkgConfig::PYTHON weechat_plugins_scripts coverage_config) endif() install(TARGETS python LIBRARY DESTINATION ${WEECHAT_LIBDIR}/plugins)