Add logic to use different FindPackage for python if cmake is above 3.12

This commit is contained in:
John Torcivia 2023-10-21 08:48:13 -04:00
parent bcb4c78fed
commit fab3ab2684

View File

@ -387,14 +387,26 @@ install(FILES
option(SQLITECPP_RUN_CPPLINT "Run cpplint.py tool for Google C++ StyleGuide." ON) option(SQLITECPP_RUN_CPPLINT "Run cpplint.py tool for Google C++ StyleGuide." ON)
if (SQLITECPP_RUN_CPPLINT) if (SQLITECPP_RUN_CPPLINT)
find_package(PythonInterp) # The minimum version of CMAKE is 3.5, but as of 3.12 the PythonInterp package is deprecated.
if (PYTHONINTERP_FOUND) if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
# add a cpplint target to the "all" target find_package(PythonInterp)
add_custom_target(SQLiteCpp_cpplint if (PYTHONINTERP_FOUND)
ALL # add a cpplint target to the "all" target
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cpplint.py ${CPPLINT_ARG_OUTPUT} ${CPPLINT_ARG_VERBOSE} ${CPPLINT_ARG_LINELENGTH} ${SQLITECPP_SRC} ${SQLITECPP_INC} add_custom_target(SQLiteCpp_cpplint
) ALL
endif (PYTHONINTERP_FOUND) COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cpplint.py ${CPPLINT_ARG_OUTPUT} ${CPPLINT_ARG_VERBOSE} ${CPPLINT_ARG_LINELENGTH} ${SQLITECPP_SRC} ${SQLITECPP_INC}
)
endif (PYTHONINTERP_FOUND)
else()
find_package(Python)
if (PYTHON_INTERPRETER_FOUND)
# add a cpplint target to the "all" target
add_custom_target(SQLiteCpp_cpplint
ALL
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cpplint.py ${CPPLINT_ARG_OUTPUT} ${CPPLINT_ARG_VERBOSE} ${CPPLINT_ARG_LINELENGTH} ${SQLITECPP_SRC} ${SQLITECPP_INC}
)
endif (PYTHON_INTERPRETER_FOUND)
endif()
else (SQLITECPP_RUN_CPPLINT) else (SQLITECPP_RUN_CPPLINT)
message(STATUS "SQLITECPP_RUN_CPPLINT OFF") message(STATUS "SQLITECPP_RUN_CPPLINT OFF")
endif (SQLITECPP_RUN_CPPLINT) endif (SQLITECPP_RUN_CPPLINT)