diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dab6613f318c09cfd09b0321417781494feafc5_Q01ha2VMaXN0cy50eHQ=..de959d58debd6bd5f6d20757965a5f961cd3a3b1_Q01ha2VMaXN0cy50eHQ= 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,10 +59,16 @@ if(LIBXSLT_WITH_PYTHON) check_include_files(unistd.h HAVE_UNISTD_H) check_symbol_exists(F_GETFL fcntl.h HAVE_F_GETFL) - find_package(Python COMPONENTS Interpreter Development REQUIRED) - #set(LIBXSLT_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory") - set(LIBXSLT_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/python" - CACHE PATH "Python bindings install directory") + if(WIN32 OR (HAVE_UNISTD_H AND HAVE_F_GETFL)) + find_package(Python COMPONENTS Interpreter Development REQUIRED) + else() + find_package(Python2 COMPONENTS Interpreter Development REQUIRED) + 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") + set(LIBXSLT_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/python" CACHE PATH "Python bindings install directory") endif() if(LIBXSLT_WITH_THREADS)