Skip to content
Snippets Groups Projects
Commit b4f8173d56a3 authored by Markus Rickert's avatar Markus Rickert
Browse files

Use Python3 if compatible

parent f20ad0d5a4ab
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
......@@ -49,4 +50,9 @@
endif()
if(LIBXSLT_WITH_PYTHON)
check_include_files(unistd.h HAVE_UNISTD_H)
check_symbol_exists(F_GETFL fcntl.h HAVE_F_GETFL)
if(HAVE_UNISTD_H AND HAVE_F_GETFL)
find_package(Python COMPONENTS Interpreter Development REQUIRED)
else()
find_package(Python2 COMPONENTS Interpreter Development REQUIRED)
......@@ -52,5 +58,9 @@
find_package(Python2 COMPONENTS Interpreter Development REQUIRED)
set(LIBXSLT_PYTHON_INSTALL_DIR ${Python2_SITEARCH} CACHE PATH "Python bindings install directory")
add_library(Python::Python ALIAS Python2::Python)
set(Python_EXECUTABLE ${Python2_EXECUTABLE})
set(Python_SITEARCH ${Python2_SITEARCH})
endif()
set(LIBXSLT_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory")
endif()
if(LIBXSLT_WITH_THREADS)
......@@ -366,7 +376,7 @@
set(ENV{SRCDIR} ${CMAKE_CURRENT_SOURCE_DIR}/python)
execute_process(
COMMAND
${Python2_EXECUTABLE}
${Python_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/python/generator.py
${CMAKE_CURRENT_SOURCE_DIR}/doc/libxslt-api.xml
${CMAKE_CURRENT_SOURCE_DIR}/python/libxslt-python-api.xml
......@@ -393,7 +403,7 @@
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/python>
)
target_link_libraries(LibXsltMod LibXslt LibExslt Python2::Python)
target_link_libraries(LibXsltMod LibXslt LibExslt Python::Python)
set_target_properties(
LibXsltMod
PROPERTIES
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment