[Cmake] FindTcl.cmake : manual install support

Sebastien BARRE sebastien at barre.nom.fr
Fri May 11 21:17:20 EDT 2001


Hi

Although I've added support for the registry keys in FindTcl.cmake, CMake 
is still unable to find my Tcl include or library path, for the simple 
reason that my Tcl distrib is installed manually.

Nevertheless, I want CMake to detect it :) I'm quite sure I'm not the only 
one using manual install in Windows. In that case, I'm also quite sure that 
one of the following condition is met (probably both) :

    A) the path to the Tcl binaries (i.e. tclsh, wish) is in the PATH
    B) there is a "File Association" set between the ".tcl" extension and 
the binary assigned to open these files.

I need some advices to solve at least one of them.

A) the path to the Tcl binaries (i.e. tclsh, wish) is in the PATH :

FIND_PROGRAM(TCL_TCLSH
   NAMES tclsh tclsh84 tclsh83 tclsh82 tclsh80
)

FIND_PROGRAM(TK_WISH
   NAMES wish wish84 wish83 wish82 wish80
)

both commands actually succeeds in finding the binaries in my system.

//Path to a program.
TCL_TCLSH:FILEPATH=C:/devel/langages/tcl/8.3/bin/tclsh83.exe

//Path to a program.
TK_WISH:FILEPATH=C:/devel/langages/tcl/8.3/bin/wish83.exe

Now in order to feed something to FIND_LIBRARY, I need to get the *path* of 
that full pathname (i.e. remove the binary name, tclsh83.exe, or 
wish83.exe), and append "../lib" (because most of us will keep the usual 
TCL_ROOT/lib, TCL_ROOT/bin, TCL_ROOT/include structure).

This simple command will fail (of course) :

FIND_LIBRARY(TCL_LIBRARY
   ${TCL_TCLSH}/../lib
   ${TK_WISTH}/../lib
)

Question : how can I perform that operation ? Should I write a new command, 
GET_FILEPATH(var fullpathname) ?

BTW, a call to FIND_PROGRAM(TCL_TCLSH ...) will actually add TCL_TCLSH to 
the GUI and the CACHE. I do not need it, I guess it clutters the interface, 
and it can be confusing. Is there a way to say that TCL_TCLSH is "local" 
(i.e. should not persist through the GUI or the cache) ?


    B) there is a "File Association" set between the ".tcl" extension and 
the binary assigned to open these files.

I do not know if it's worth the try, because the 'default pathname" + "the 
registry" + A) will probably meet 99% of the requirements. Anyway, for the 
sake of completeness :

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tcl
  "Application" => wish83.exe

HKEY_CLASSES_ROOT\Applications\wish83.exe\shell\open\command
or
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\wish83.exe\shell\open\command
   "defaults" => C:\devel\langages\tcl\8.3\bin\wis83.exe "%1"

which leads to the directory holding the binaries (hence a good probability 
to find the lib/ and include/ path).

Thanks





More information about the CMake mailing list