FindTclsh.cmake 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # - Find tclsh
  2. # This module finds if TCL is installed and determines where the
  3. # include files and libraries are. It also determines what the name of
  4. # the library is. This code sets the following variables:
  5. # TCLSH_FOUND = TRUE if tclsh has been found
  6. # TCL_TCLSH = the path to the tclsh executable
  7. # In cygwin, look for the cygwin version first. Don't look for it later to
  8. # avoid finding the cygwin version on a Win32 build.
  9. IF(WIN32 AND UNIX)
  10. FIND_PROGRAM(TCL_TCLSH NAMES cygtclsh83 cygtclsh80)
  11. ENDIF(WIN32 AND UNIX)
  12. GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
  13. GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
  14. STRING(REGEX REPLACE
  15. "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
  16. GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
  17. GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
  18. GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
  19. GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH)
  20. STRING(REGEX REPLACE
  21. "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}")
  22. GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH)
  23. GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH)
  24. STRING(REGEX REPLACE
  25. "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}")
  26. SET(TCLTK_POSSIBLE_BIN_PATHS
  27. "${TCL_INCLUDE_PATH_PARENT}/bin"
  28. "${TK_INCLUDE_PATH_PARENT}/bin"
  29. "${TCL_LIBRARY_PATH_PARENT}/bin"
  30. "${TK_LIBRARY_PATH_PARENT}/bin"
  31. "${TK_WISH_PATH_PARENT}/bin"
  32. )
  33. IF(WIN32)
  34. GET_FILENAME_COMPONENT(
  35. ActiveTcl_CurrentVersion
  36. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
  37. NAME)
  38. SET(TCLTK_POSSIBLE_BIN_PATHS ${TCLTK_POSSIBLE_BIN_PATHS}
  39. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin"
  40. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin"
  41. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin"
  42. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/bin"
  43. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/bin"
  44. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/bin"
  45. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin"
  46. )
  47. ENDIF(WIN32)
  48. SET(TCL_TCLSH_NAMES
  49. tclsh
  50. tclsh${TCL_LIBRARY_VERSION} tclsh${TK_LIBRARY_VERSION} tclsh${TK_WISH_VERSION}
  51. tclsh86 tclsh8.6
  52. tclsh85 tclsh8.5
  53. tclsh84 tclsh8.4
  54. tclsh83 tclsh8.3
  55. tclsh82 tclsh8.2
  56. tclsh80 tclsh8.0
  57. )
  58. FIND_PROGRAM(TCL_TCLSH
  59. NAMES ${TCL_TCLSH_NAMES}
  60. PATHS ${TCLTK_POSSIBLE_BIN_PATHS} NO_DEFAULT_PATH
  61. )
  62. FIND_PROGRAM(TCL_TCLSH
  63. NAMES ${TCL_TCLSH_NAMES}
  64. PATHS ${TCLTK_POSSIBLE_BIN_PATHS}
  65. )
  66. # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
  67. # all listed variables are TRUE
  68. INCLUDE(FindPackageHandleStandardArgs)
  69. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh DEFAULT_MSG TCL_TCLSH)
  70. MARK_AS_ADVANCED(TCL_TCLSH)