File: FindGo.cmake

package info (click to toggle)
mlpack 4.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 31,272 kB
  • sloc: cpp: 226,039; python: 1,934; sh: 1,198; lisp: 414; makefile: 85
file content (28 lines) | stat: -rw-r--r-- 629 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# FindGo.cmake
if (GO_FOUND)
  return()
endif()

# Find the Go program.
find_program(GO_EXECUTABLE go DOC "Go executable")

# Get the Go version.
if (GO_EXECUTABLE)
  execute_process(
       COMMAND ${GO_EXECUTABLE} version 
       OUTPUT_VARIABLE GO_VERSION_STRING
       RESULT_VARIABLE RESULT
  )
  if (RESULT EQUAL 0)
    string(REGEX MATCH "([0-9]+\\.[0-9]+\(\\.[0-9]+\)?)"
        GO_VERSION_STRING "${GO_VERSION_STRING}")
  endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
    Go
    REQUIRED_VARS GO_EXECUTABLE
    VERSION_VAR GO_VERSION_STRING
    FAIL_MESSAGE "Go not found"
)