PYTHON.cmake: don't use PythonLibs on new cmake

This commit is contained in:
Christoph Junghans 2020-04-05 11:43:54 -06:00
parent 6f5fcd66ac
commit 909b2dcff8
1 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,11 @@
if(PKG_PYTHON)
find_package(PythonLibs REQUIRED)
if(CMAKE_VERSION VERSION_LESS 3.12)
find_package(PythonLibs REQUIRED) # Deprecated since version 3.12
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIR})
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARY})
else()
find_package(Python REQUIRED COMPONENTS Development)
target_link_libraries(lammps PRIVATE Python::Python)
endif()
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIR})
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARY})
endif()