My CMake modules, scripts, templates
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindVala.cmake 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ##
  2. # Find module for the Vala compiler (valac)
  3. #
  4. # This module determines wheter a Vala compiler is installed on the current
  5. # system and where its executable is.
  6. #
  7. # Call the module using "find_package(Vala) from within your CMakeLists.txt.
  8. #
  9. # The following variables will be set after an invocation:
  10. #
  11. # VALA_FOUND Whether the vala compiler has been found or not
  12. # VALA_EXECUTABLE Full path to the valac executable if it has been found
  13. # VALA_VERSION Version number of the available valac
  14. # VALA_USE_FILE Include this file to define the vala_precompile function
  15. ##
  16. ##
  17. # Copyright 2009-2010 Jakob Westhoff. All rights reserved.
  18. # Copyright 2010-2011 Daniel Pfeifer
  19. #
  20. # Redistribution and use in source and binary forms, with or without
  21. # modification, are permitted provided that the following conditions are met:
  22. #
  23. # 1. Redistributions of source code must retain the above copyright notice,
  24. # this list of conditions and the following disclaimer.
  25. #
  26. # 2. Redistributions in binary form must reproduce the above copyright notice,
  27. # this list of conditions and the following disclaimer in the documentation
  28. # and/or other materials provided with the distribution.
  29. #
  30. # THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
  31. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  32. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  33. # EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  34. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  36. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  37. # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  38. # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  39. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. #
  41. # The views and conclusions contained in the software and documentation are those
  42. # of the authors and should not be interpreted as representing official policies,
  43. # either expressed or implied, of Jakob Westhoff
  44. ##
  45. # Search for the valac executable in the usual system paths.
  46. find_program(VALA_EXECUTABLE valac)
  47. mark_as_advanced(VALA_EXECUTABLE)
  48. # Determine the valac version
  49. if(VALA_EXECUTABLE)
  50. execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
  51. OUTPUT_VARIABLE VALA_VERSION
  52. OUTPUT_STRIP_TRAILING_WHITESPACE)
  53. string(REPLACE "Vala " "" VALA_VERSION "${VALA_VERSION}")
  54. endif(VALA_EXECUTABLE)
  55. # Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
  56. # Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
  57. # VALA_EXECUTABLE is set)
  58. include(FindPackageHandleStandardArgs)
  59. find_package_handle_standard_args(Vala
  60. REQUIRED_VARS VALA_EXECUTABLE
  61. VERSION_VAR VALA_VERSION)
  62. set(VALA_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseVala.cmake")