FindGnuplot.cmake 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. this module looks for gnuplot
  7. Once done this will define
  8. ::
  9. GNUPLOT_FOUND - system has Gnuplot
  10. GNUPLOT_EXECUTABLE - the Gnuplot executable
  11. GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
  12. GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1.
  13. #]=======================================================================]
  14. include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
  15. find_program(GNUPLOT_EXECUTABLE
  16. NAMES
  17. gnuplot
  18. pgnuplot
  19. wgnupl32
  20. PATHS
  21. ${CYGWIN_INSTALL_PATH}/bin
  22. )
  23. if (GNUPLOT_EXECUTABLE)
  24. execute_process(COMMAND "${GNUPLOT_EXECUTABLE}" --version
  25. OUTPUT_VARIABLE GNUPLOT_OUTPUT_VARIABLE
  26. ERROR_QUIET
  27. OUTPUT_STRIP_TRAILING_WHITESPACE)
  28. string(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}")
  29. string(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}")
  30. unset(GNUPLOT_OUTPUT_VARIABLE)
  31. endif()
  32. # for compatibility
  33. set(GNUPLOT ${GNUPLOT_EXECUTABLE})
  34. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  35. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot
  36. REQUIRED_VARS GNUPLOT_EXECUTABLE
  37. VERSION_VAR GNUPLOT_VERSION_STRING)
  38. mark_as_advanced( GNUPLOT_EXECUTABLE )