Posted to tcl by STEVE!!!!!!!!!! at Wed Nov 26 00:03:43 GMT 2014view raw

  1. # - Find the Tcl package path.
  2. # This module finds where Tcl is looking for installed packages. It
  3. # sets the following variable:
  4. # TCL_PACKAGE_PATH = path to Tcl packages (tcllib etc)
  5. #
  6. # Copyright (c) 2013, 2014 Steve Havelka
  7. #
  8. # Redistribution and use is allowed according to the terms of the LICENSE
  9. # file.
  10. #
  11.  
  12. file (WRITE ${CMAKE_BINARY_DIR}/readpkgPath.tcl "puts [join $auto_path {;}]")
  13.  
  14. # Retrieve the value of $tcl_pkgPath from the tclsh that's been found.
  15. execute_process (COMMAND ${TCL_TCLSH} ${CMAKE_BINARY_DIR}/readpkgPath.tcl
  16. OUTPUT_VARIABLE TCL_DETECTED_MODULE_DIRS
  17. OUTPUT_STRIP_TRAILING_WHITESPACE)
  18.  
  19. foreach (DIR ${TCL_DETECTED_MODULE_DIRS})
  20. if (IS_DIRECTORY "${DIR}")
  21. set (TCL_PACKAGE_PATH "${DIR}" CACHE PATH "path to Tcl packages")
  22. break ()
  23. endif()
  24. endforeach()
  25.  
  26. # remove the temporary tcl script
  27. file (REMOVE ${CMAKE_BINARY_DIR}/readpkgPath.tcl)
  28.