FindGnuplot.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # - this module looks for gnuplot
  2. #
  3. # Once done this will define
  4. #
  5. # GNUPLOT_FOUND - system has Gnuplot
  6. # GNUPLOT_EXECUTABLE - the Gnuplot executable
  7. # GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8)
  8. #
  9. # GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1.
  10. #=============================================================================
  11. # Copyright 2002-2009 Kitware, Inc.
  12. #
  13. # Distributed under the OSI-approved BSD License (the "License");
  14. # see accompanying file Copyright.txt for details.
  15. #
  16. # This software is distributed WITHOUT ANY WARRANTY; without even the
  17. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. # See the License for more information.
  19. #=============================================================================
  20. # (To distribute this file outside of CMake, substitute the full
  21. # License text for the above reference.)
  22. include(FindCygwin)
  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. # handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if
  43. # all listed variables are TRUE
  44. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  45. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot
  46. REQUIRED_VARS GNUPLOT_EXECUTABLE
  47. VERSION_VAR GNUPLOT_VERSION_STRING)
  48. mark_as_advanced( GNUPLOT_EXECUTABLE )