FindGnuplot.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #.rst:
  4. # FindGnuplot
  5. # -----------
  6. #
  7. # this module looks for gnuplot
  8. #
  9. #
  10. #
  11. # Once done this will define
  12. #
  13. # ::
  14. #
  15. # GNUPLOT_FOUND - system has Gnuplot
  16. # GNUPLOT_EXECUTABLE - the Gnuplot executable
  17. # GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
  18. #
  19. #
  20. #
  21. # GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1.
  22. include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
  23. find_program(GNUPLOT_EXECUTABLE
  24. NAMES
  25. gnuplot
  26. pgnuplot
  27. wgnupl32
  28. PATHS
  29. ${CYGWIN_INSTALL_PATH}/bin
  30. )
  31. if (GNUPLOT_EXECUTABLE)
  32. execute_process(COMMAND "${GNUPLOT_EXECUTABLE}" --version
  33. OUTPUT_VARIABLE GNUPLOT_OUTPUT_VARIABLE
  34. ERROR_QUIET
  35. OUTPUT_STRIP_TRAILING_WHITESPACE)
  36. string(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}")
  37. string(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}")
  38. unset(GNUPLOT_OUTPUT_VARIABLE)
  39. endif()
  40. # for compatibility
  41. set(GNUPLOT ${GNUPLOT_EXECUTABLE})
  42. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  43. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot
  44. REQUIRED_VARS GNUPLOT_EXECUTABLE
  45. VERSION_VAR GNUPLOT_VERSION_STRING)
  46. mark_as_advanced( GNUPLOT_EXECUTABLE )