for consistency with CMake 3.12+ we should set Python_EXECUTABLE instead of PYTHON_EXECUTABLE
This commit is contained in:
@ -159,17 +159,20 @@ endif()
|
||||
########################################################################
|
||||
# User input options #
|
||||
########################################################################
|
||||
# set path to python interpreter and thus enforcing python version when
|
||||
# in a virtual environment and PYTHON_EXECUTABLE is not set on command line
|
||||
if(DEFINED ENV{VIRTUAL_ENV} AND NOT PYTHON_EXECUTABLE)
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(PYTHON_EXECUTABLE "$ENV{VIRTUAL_ENV}/Scripts/python.exe")
|
||||
else()
|
||||
set(PYTHON_EXECUTABLE "$ENV{VIRTUAL_ENV}/bin/python")
|
||||
endif()
|
||||
# backward compatibility with CMake before 3.12 and older LAMMPS documentation
|
||||
if (PYTHON_EXECUTABLE)
|
||||
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
||||
endif()
|
||||
# set path to python interpreter and thus enforcing python version when
|
||||
# in a virtual environment and Python_EXECUTABLE is not set on command line
|
||||
if(DEFINED ENV{VIRTUAL_ENV} AND NOT Python_EXECUTABLE)
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(Python_EXECUTABLE "$ENV{VIRTUAL_ENV}/Scripts/python.exe")
|
||||
else()
|
||||
set(Python_EXECUTABLE "$ENV{VIRTUAL_ENV}/bin/python")
|
||||
endif()
|
||||
message(STATUS "Running in virtual environment: $ENV{VIRTUAL_ENV}\n"
|
||||
" Setting Python interpreter to: ${PYTHON_EXECUTABLE}")
|
||||
" Setting Python interpreter to: ${Python_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
||||
@ -794,9 +797,6 @@ install(
|
||||
###############################################################################
|
||||
if(BUILD_SHARED_LIBS)
|
||||
# backward compatibility
|
||||
if(PYTHON_EXECUTABLE)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
if(BUILD_IS_MULTI_CONFIG)
|
||||
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
if(NOT Python_INTERPRETER)
|
||||
# backward compatibility
|
||||
# backward compatibility with CMake before 3.12 and older LAMMPS documentation
|
||||
if(PYTHON_EXECUTABLE)
|
||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
endif()
|
||||
|
||||
@ -1056,12 +1056,12 @@ additional details.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
-D PYTHON_EXECUTABLE=path # path to Python executable to use
|
||||
-D Python_EXECUTABLE=path # path to Python executable to use
|
||||
|
||||
Without this setting, CMake will guess the default Python version
|
||||
on your system. To use a different Python version, you can either
|
||||
create a virtualenv, activate it and then run cmake. Or you can
|
||||
set the PYTHON_EXECUTABLE variable to specify which Python
|
||||
set the Python_EXECUTABLE variable to specify which Python
|
||||
interpreter should be used. Note note that you will also need to
|
||||
have the development headers installed for this version,
|
||||
e.g. python2-devel.
|
||||
|
||||
@ -133,7 +133,7 @@ to the location in the virtual environment with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cmake . -DPYTHON_EXECUTABLE=$(which python)
|
||||
cmake . -DPython_EXECUTABLE=$(which python)
|
||||
|
||||
# install LAMMPS package in virtualenv
|
||||
(testing) make install-python
|
||||
|
||||
Reference in New Issue
Block a user