Make quiet Python 3 check

This commit is contained in:
Richard Berger
2020-06-13 08:28:48 -04:00
parent cf5fa3959c
commit fcd3e9a3f9

View File

@ -1,21 +1,24 @@
if(CMAKE_VERSION VERSION_LESS 3.12) if(CMAKE_VERSION VERSION_LESS 3.12)
find_package(PythonInterp) # Deprecated since version 3.12 find_package(PythonInterp 3.5 QUIET) # Deprecated since version 3.12
if(PYTHONINTERP_FOUND) if(PYTHONINTERP_FOUND)
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
set(Python3_VERSION ${PYTHON_VERSION_STRING})
endif() endif()
else() else()
find_package(Python COMPONENTS Interpreter) find_package(Python3 COMPONENTS Interpreter QUIET)
endif() endif()
if (Python_EXECUTABLE) if (Python3_EXECUTABLE)
add_custom_target( if(Python3_VERSION VERSION_GREATER_EQUAL 3.5)
check-whitespace add_custom_target(
${Python_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py . check-whitespace
WORKING_DIRECTORY ${LAMMPS_DIR} ${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
COMMENT "Check for whitespace errors") WORKING_DIRECTORY ${LAMMPS_DIR}
add_custom_target( COMMENT "Check for whitespace errors")
fix-whitespace add_custom_target(
${Python_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f . fix-whitespace
WORKING_DIRECTORY ${LAMMPS_DIR} ${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py -f .
COMMENT "Fix whitespace errors") WORKING_DIRECTORY ${LAMMPS_DIR}
COMMENT "Fix whitespace errors")
endif()
endif() endif()