mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
CMake: use pkg-config to find python.
Makes it easier to override its path.
This commit is contained in:
@@ -129,7 +129,8 @@ set(HAVE_ICU "${ICU_FOUND}")
|
||||
|
||||
set(WANT_PERL false CACHE BOOL "Support Perl modules")
|
||||
set(WANT_PYTHON false CACHE BOOL "Support Python modules")
|
||||
set(WANT_PYTHON_VERSION "" CACHE STRING "Python version to use, or empty")
|
||||
set(WANT_PYTHON_VERSION "python3" CACHE STRING
|
||||
"Python version to use, e.g. python-3.5, this name is passed to pkg-config")
|
||||
if(WANT_PYTHON AND NOT ICU_FOUND)
|
||||
message(FATAL_ERROR "Modpython requires ZNC to be compiled with charset "
|
||||
"support, but ICU library not found")
|
||||
@@ -171,11 +172,7 @@ if(WANT_PERL)
|
||||
endif()
|
||||
if (WANT_PYTHON)
|
||||
find_package(Perl 5.10 REQUIRED)
|
||||
if(WANT_PYTHON_VERSION)
|
||||
find_package(PythonLibs "${WANT_PYTHON_VERSION}" EXACT REQUIRED)
|
||||
else()
|
||||
find_package(PythonLibs 3 REQUIRED)
|
||||
endif()
|
||||
pkg_check_modules(PYTHON "${WANT_PYTHON_VERSION}" REQUIRED)
|
||||
endif()
|
||||
|
||||
set(WANT_TCL false CACHE BOOL "Support Tcl modules")
|
||||
@@ -345,7 +342,7 @@ summary_line("SSL " "${OPENSSL_FOUND}")
|
||||
summary_line("IPv6 " "${WANT_IPV6}")
|
||||
summary_line("Async DNS" "${HAVE_THREADED_DNS}")
|
||||
summary_line("Perl " "${PERLLIBS_FOUND}")
|
||||
summary_line("Python " "${PYTHONLIBS_FOUND}")
|
||||
summary_line("Python " "${PYTHON_FOUND}")
|
||||
summary_line("Tcl " "${TCL_FOUND}")
|
||||
summary_line("Cyrus " "${CYRUS_FOUND}")
|
||||
summary_line("Charset " "${ICU_FOUND}")
|
||||
|
||||
@@ -88,9 +88,7 @@ class HandlePython(argparse.Action):
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
extra_args.append('-DWANT_PYTHON=YES')
|
||||
if values is not None:
|
||||
x = re.search(r'\d.*', values)
|
||||
if x:
|
||||
extra_args.append('-DWANT_PYTHON_VERSION=' + x.group(0))
|
||||
extra_args.append('-DWANT_PYTHON_VERSION=' + values)
|
||||
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument('--enable-python', action=HandlePython, nargs='?',
|
||||
|
||||
@@ -67,7 +67,7 @@ else()
|
||||
set(moddisable_modperl true)
|
||||
endif()
|
||||
|
||||
if(PYTHONLIBS_FOUND)
|
||||
if(PYTHON_FOUND)
|
||||
add_subdirectory(modpython)
|
||||
else()
|
||||
set(moddisable_modpython true)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
set(modinclude_modpython PUBLIC ${PYTHON_INCLUDE_DIRS}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/.." PARENT_SCOPE)
|
||||
set(modlink_modpython PUBLIC ${PYTHON_LIBRARIES} PARENT_SCOPE)
|
||||
set(modlink_modpython PUBLIC ${PYTHON_LDFLAGS} PARENT_SCOPE)
|
||||
set(moddef_modpython PUBLIC "SWIG_TYPE_TABLE=znc" PARENT_SCOPE)
|
||||
set(moddepend_modpython modpython_functions modpython_swigruntime PARENT_SCOPE)
|
||||
|
||||
@@ -76,7 +76,7 @@ target_include_directories(modpython_lib PRIVATE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/.."
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/.."
|
||||
${PYTHON_INCLUDE_DIRS})
|
||||
target_link_libraries(modpython_lib ${znc_link} ${PYTHON_LIBRARIES})
|
||||
target_link_libraries(modpython_lib ${znc_link} ${PYTHON_LDFLAGS})
|
||||
set_target_properties(modpython_lib PROPERTIES
|
||||
PREFIX "_"
|
||||
OUTPUT_NAME "znc_core"
|
||||
|
||||
Reference in New Issue
Block a user