FindFlake8.cmake 982 B

1234567891011121314151617181920212223242526272829303132
  1. # - Find Flake8
  2. # Find the Flake8 executable and extract the version number
  3. #
  4. # OUTPUT Variables
  5. #
  6. # FLAKE8_FOUND
  7. # True if the flake8 package was found
  8. # FLAKE8_EXECUTABLE
  9. # The flake8 executable location
  10. # FLAKE8_VERSION
  11. # A string denoting the version of flake8 that has been found
  12. find_host_program(FLAKE8_EXECUTABLE flake8 PATHS /usr/bin)
  13. if(FLAKE8_EXECUTABLE AND NOT DEFINED FLAKE8_VERSION)
  14. execute_process(COMMAND ${FLAKE8_EXECUTABLE} --version RESULT_VARIABLE _result OUTPUT_VARIABLE FLAKE8_VERSION_RAW)
  15. if(NOT _result EQUAL 0)
  16. ocv_clear_vars(FLAKE8_EXECUTABLE FLAKE8_VERSION)
  17. elseif(FLAKE8_VERSION_RAW MATCHES "^([0-9\\.]+[0-9])")
  18. set(FLAKE8_VERSION "${CMAKE_MATCH_1}")
  19. else()
  20. set(FLAKE8_VERSION "unknown")
  21. endif()
  22. endif()
  23. include(FindPackageHandleStandardArgs)
  24. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Flake8
  25. REQUIRED_VARS FLAKE8_EXECUTABLE
  26. VERSION_VAR FLAKE8_VERSION
  27. )
  28. mark_as_advanced(FLAKE8_EXECUTABLE FLAKE8_VERSION)