]> git.donarmstrong.com Git - kiibohd-controller.git/blob - Lib/CMake/FindCtags.cmake
Fixing CMake dependency checking for kll_defs.h
[kiibohd-controller.git] / Lib / CMake / FindCtags.cmake
1 # The module defines the following variables:
2 #   CTAGS_EXECUTABLE - path to ctags command line client
3 #   CTAGS_FOUND - true if the command line client was found
4 #   CTAGS_VERSION_STRING - the version of ctags found (since CMake 2.8.8)
5 # Example usage:
6 #   find_package( Ctags )
7 #   if( CTAGS_FOUND )
8 #     message("ctags found: ${CTAGS_EXECUTABLE}")
9 #   endif()
10
11 find_program( CTAGS_EXECUTABLE
12         NAMES ctags
13         DOC "ctags executable"
14 )
15 mark_as_advanced( CTAGS_EXECUTABLE )
16
17 if( CTAGS_EXECUTABLE )
18         execute_process(COMMAND ${CTAGS_EXECUTABLE} --version
19                 OUTPUT_VARIABLE ctags_version
20                 ERROR_QUIET
21                 OUTPUT_STRIP_TRAILING_WHITESPACE
22         )
23
24         if( ctags_version MATCHES "^Exuberant Ctags [0-9]" )
25                 string( REPLACE "Exuberant Ctags " "" CTAGS_VERSION_STRING "${ctags_version}" )
26                 string( REGEX REPLACE ",.*$" "" CTAGS_VERSION_STRING ${CTAGS_VERSION_STRING} )
27         endif()
28
29         unset( ctags_version )
30 endif()
31
32 # Handle the QUIETLY and REQUIRED arguments and set CTAGS_FOUND to TRUE if
33 # all listed variables are TRUE
34
35 include( FindPackageHandleStandardArgs )
36 find_package_handle_standard_args( Ctags
37         REQUIRED_VARS CTAGS_EXECUTABLE
38         VERSION_VAR CTAGS_VERSION_STRING
39 )
40