FindGnuplot.cmake 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. # Copyright 2002-2009 Kitware, Inc.
  10. #
  11. # Distributed under the OSI-approved BSD License (the "License");
  12. # see accompanying file Copyright.txt for details.
  13. #
  14. # This software is distributed WITHOUT ANY WARRANTY; without even the
  15. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. # See the License for more information.
  17. #=============================================================================
  18. # (To distribute this file outside of CMake, substitute the full
  19. # License text for the above reference.)
  20. INCLUDE(FindCygwin)
  21. FIND_PROGRAM(GNUPLOT_EXECUTABLE
  22. NAMES
  23. gnuplot
  24. pgnuplot
  25. wgnupl32
  26. PATHS
  27. ${CYGWIN_INSTALL_PATH}/bin
  28. )
  29. IF (GNUPLOT_EXECUTABLE)
  30. EXECUTE_PROCESS(COMMAND "${GNUPLOT_EXECUTABLE}" --version
  31. OUTPUT_VARIABLE GNUPLOT_OUTPUT_VARIABLE
  32. ERROR_QUIET
  33. OUTPUT_STRIP_TRAILING_WHITESPACE)
  34. STRING(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}")
  35. STRING(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}")
  36. UNSET(GNUPLOT_OUTPUT_VARIABLE)
  37. ENDIF()
  38. # for compatibility
  39. SET(GNUPLOT ${GNUPLOT_EXECUTABLE})
  40. # handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if
  41. # all listed variables are TRUE
  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 )