FindTclStub.cmake 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # - Find Tcl stub libraries.
  2. # This module finds Tcl stub libraries. It first finds Tcl include files and
  3. # libraries by calling FindTCL.cmake.
  4. # How to Use the Tcl Stubs Library:
  5. # http://tcl.activestate.com/doc/howto/stubs.html
  6. # Using Stub Libraries:
  7. # http://safari.oreilly.com/0130385603/ch48lev1sec3
  8. # This code sets the following variables:
  9. # TCL_STUB_LIBRARY = path to Tcl stub library
  10. # TK_STUB_LIBRARY = path to Tk stub library
  11. #
  12. # In an effort to remove some clutter and clear up some issues for people
  13. # who are not necessarily Tcl/Tk gurus/developpers, some variables were
  14. # moved or removed. Changes compared to CMake 2.4 are:
  15. # - TCL_STUB_LIBRARY_DEBUG and TK_STUB_LIBRARY_DEBUG were removed.
  16. # => these libs are not packaged by default with Tcl/Tk distributions.
  17. # Even when Tcl/Tk is built from source, several flavors of debug libs
  18. # are created and there is no real reason to pick a single one
  19. # specifically (say, amongst tclstub84g, tclstub84gs, or tclstub84sgx).
  20. # Let's leave that choice to the user by allowing him to assign
  21. # TCL_STUB_LIBRARY to any Tcl library, debug or not.
  22. INCLUDE(FindTCL)
  23. GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
  24. GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
  25. STRING(REGEX REPLACE
  26. "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
  27. GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
  28. GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
  29. STRING(REGEX REPLACE
  30. "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
  31. GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
  32. GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
  33. GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
  34. GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH)
  35. STRING(REGEX REPLACE
  36. "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}")
  37. GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH)
  38. GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH)
  39. STRING(REGEX REPLACE
  40. "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}")
  41. SET(TCLTK_POSSIBLE_LIB_PATHS
  42. "${TCL_INCLUDE_PATH_PARENT}/lib"
  43. "${TK_INCLUDE_PATH_PARENT}/lib"
  44. "${TCL_LIBRARY_PATH}"
  45. "${TK_LIBRARY_PATH}"
  46. "${TCL_TCLSH_PATH_PARENT}/lib"
  47. "${TK_WISH_PATH_PARENT}/lib"
  48. /usr/lib
  49. /usr/local/lib
  50. )
  51. IF(WIN32)
  52. GET_FILENAME_COMPONENT(
  53. ActiveTcl_CurrentVersion
  54. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
  55. NAME)
  56. SET(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
  57. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib"
  58. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib"
  59. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib"
  60. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib"
  61. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib"
  62. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib"
  63. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib"
  64. "$ENV{ProgramFiles}/Tcl/Lib"
  65. "C:/Program Files/Tcl/lib"
  66. "C:/Tcl/lib"
  67. )
  68. ENDIF(WIN32)
  69. FIND_LIBRARY(TCL_STUB_LIBRARY
  70. NAMES
  71. tclstub
  72. tclstub${TK_LIBRARY_VERSION} tclstub${TCL_TCLSH_VERSION} tclstub${TK_WISH_VERSION}
  73. tclstub86 tclstub8.6
  74. tclstub85 tclstub8.5
  75. tclstub84 tclstub8.4
  76. tclstub83 tclstub8.3
  77. tclstub82 tclstub8.2
  78. tclstub80 tclstub8.0
  79. PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
  80. )
  81. FIND_LIBRARY(TK_STUB_LIBRARY
  82. NAMES
  83. tkstub
  84. tkstub${TCL_LIBRARY_VERSION} tkstub${TCL_TCLSH_VERSION} tkstub${TK_WISH_VERSION}
  85. tkstub86 tkstub8.6
  86. tkstub85 tkstub8.5
  87. tkstub84 tkstub8.4
  88. tkstub83 tkstub8.3
  89. tkstub82 tkstub8.2
  90. tkstub80 tkstub8.0
  91. PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
  92. )
  93. MARK_AS_ADVANCED(
  94. TCL_STUB_LIBRARY
  95. TK_STUB_LIBRARY
  96. )