PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/cmake/FindSCP.cmake

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 40 lines | 24 code | 4 blank | 12 comment | 0 complexity | 94779ac59ef6b9ef3eac955329c32997 MD5 | raw file
 1# -*- cmake -*-
 2#
 3# Find the OpenSSH scp ("secure copy") or Putty pscp command.
 4#
 5# Input variables:
 6#   SCP_FIND_REQUIRED - set this if configuration should fail without scp
 7#
 8# Output variables:
 9#
10#   SCP_FOUND - set if scp was found
11#   SCP_EXECUTABLE - path to scp or pscp executable
12#   SCP_BATCH_FLAG - how to put scp/pscp into batch mode
13
14SET(SCP_EXECUTABLE)
15IF (WINDOWS)
16  FIND_PROGRAM(SCP_EXECUTABLE NAMES pscp pscp.exe)
17ELSE (WINDOWS)
18  FIND_PROGRAM(SCP_EXECUTABLE NAMES scp scp.exe)
19ENDIF (WINDOWS)
20
21IF (SCP_EXECUTABLE)
22  SET(SCP_FOUND ON)
23ELSE (SCP_EXECUTABLE)
24  SET(SCP_FOUND OFF)
25ENDIF (SCP_EXECUTABLE)
26
27IF (SCP_FOUND)
28  GET_FILENAME_COMPONENT(_scp_name ${SCP_EXECUTABLE} NAME_WE)
29  IF (_scp_name STREQUAL scp)
30    SET(SCP_BATCH_FLAG -B)
31  ELSE (_scp_name STREQUAL scp)
32    SET(SCP_BATCH_FLAG -batch)
33  ENDIF (_scp_name STREQUAL scp)
34ELSE (SCP_FOUND)
35  IF (SCP_FIND_REQUIRED)
36    MESSAGE(FATAL_ERROR "Could not find scp or pscp executable")
37  ENDIF (SCP_FIND_REQUIRED)
38ENDIF (SCP_FOUND)
39
40MARK_AS_ADVANCED(SCP_EXECUTABLE SCP_FOUND SCP_BATCH_FLAG)