Skip to content

Commit

Permalink
Merge pull request #343 from isuruf/pypy
Browse files Browse the repository at this point in the history
Check for PYTHON_LIBRARY only on windows
  • Loading branch information
isuruf authored Mar 14, 2021
2 parents d2e11bf + 38c97bc commit 22d3d93
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cmake/FindPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ message(STATUS "Python version: ${PYTHON_VERSION}")

string(REPLACE "." "" PYTHON_VERSION_WITHOUT_DOTS ${PYTHON_VERSION})

FIND_LIBRARY(PYTHON_LIBRARY NAMES
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
FIND_LIBRARY(PYTHON_LIBRARY NAMES
python${PYTHON_VERSION}
python${PYTHON_VERSION}m
python${PYTHON_VERSION_WITHOUT_DOTS}
PATHS ${PYTHON_LIB_PATH} ${PYTHON_PREFIX_PATH}/lib ${PYTHON_PREFIX_PATH}/libs
PATH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE}
NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
PATHS ${PYTHON_LIB_PATH} ${PYTHON_PREFIX_PATH}/lib ${PYTHON_PREFIX_PATH}/libs
PATH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE}
NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
endif()

execute_process(
COMMAND ${PYTHON_BIN} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
Expand All @@ -66,7 +68,12 @@ set(PYTHON_EXTENSION_SOABI ${PYTHON_EXTENSION_SOABI_tmp}
CACHE STRING "Suffix for python extensions")

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Python DEFAULT_MSG PYTHON_LIBRARY PYTHON_INCLUDE_PATH PYTHON_INSTALL_PATH)

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Python DEFAULT_MSG PYTHON_LIBRARY PYTHON_INCLUDE_PATH PYTHON_INSTALL_PATH)
else ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Python DEFAULT_MSG PYTHON_INCLUDE_PATH PYTHON_INSTALL_PATH)
endif ()


# Links a Python extension module.
Expand Down

0 comments on commit 22d3d93

Please # to comment.