diff options
Diffstat (limited to 'cmake/FindTCL.cmake')
-rw-r--r-- | cmake/FindTCL.cmake | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/cmake/FindTCL.cmake b/cmake/FindTCL.cmake index 8a92a9da6..01352eb74 100644 --- a/cmake/FindTCL.cmake +++ b/cmake/FindTCL.cmake @@ -51,26 +51,26 @@ # this point it is safer you ask directly where the *source* tree is # and dig from there. -IF(TCL_FOUND) - SET(TCL_FIND_QUIETLY TRUE) -ENDIF(TCL_FOUND) +if(TCL_FOUND) + set(TCL_FIND_QUIETLY TRUE) +endif() -INCLUDE(CMakeFindFrameworks) -INCLUDE(FindTclsh) +include(CMakeFindFrameworks) +include(FindTclsh) -GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) -GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) +get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) +string(REGEX REPLACE "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}") -GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) +get_filename_component(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) -GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) -STRING(REGEX REPLACE +get_filename_component(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH) +get_filename_component(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH) +string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_VERSION "${TCL_LIBRARY}") -SET(TCL_POSSIBLE_LIB_PATHS +set(TCL_POSSIBLE_LIB_PATHS "${TCL_INCLUDE_PATH_PARENT}/lib" "${TCL_INCLUDE_PATH_PARENT}/lib64" "${TCL_LIBRARY_PATH}" @@ -82,12 +82,12 @@ SET(TCL_POSSIBLE_LIB_PATHS /usr/local/lib64 ) -IF(WIN32) - GET_FILENAME_COMPONENT( +if(WIN32) + get_filename_component( ActiveTcl_CurrentVersion "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" NAME) - SET(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + set(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib" @@ -95,9 +95,9 @@ IF(WIN32) "C:/Program Files/Tcl/lib" "C:/Tcl/lib" ) -ENDIF(WIN32) +endif() -FIND_LIBRARY(TCL_LIBRARY +find_library(TCL_LIBRARY NAMES tcl86 tcl8.6 tcl85 tcl8.5 @@ -106,18 +106,18 @@ FIND_LIBRARY(TCL_LIBRARY PATHS ${TCL_POSSIBLE_LIB_PATHS} ) -CMAKE_FIND_FRAMEWORKS(Tcl) +cmake_find_frameworks(Tcl) -SET(TCL_FRAMEWORK_INCLUDES) -IF(Tcl_FRAMEWORKS) - IF(NOT TCL_INCLUDE_PATH) - FOREACH(dir ${Tcl_FRAMEWORKS}) - SET(TCL_FRAMEWORK_INCLUDES ${TCL_FRAMEWORK_INCLUDES} ${dir}/Headers) - ENDFOREACH(dir) - ENDIF(NOT TCL_INCLUDE_PATH) -ENDIF(Tcl_FRAMEWORKS) +set(TCL_FRAMEWORK_INCLUDES) +if(Tcl_FRAMEWORKS) + if(NOT TCL_INCLUDE_PATH) + foreach(dir ${Tcl_FRAMEWORKS}) + set(TCL_FRAMEWORK_INCLUDES ${TCL_FRAMEWORK_INCLUDES} ${dir}/Headers) + endforeach(dir) + endif() +endif() -SET(TCL_POSSIBLE_INCLUDE_PATHS +set(TCL_POSSIBLE_INCLUDE_PATHS "${TCL_LIBRARY_PATH_PARENT}/include" "${TCL_INCLUDE_PATH}" ${TCL_FRAMEWORK_INCLUDES} @@ -132,9 +132,8 @@ SET(TCL_POSSIBLE_INCLUDE_PATHS /usr/local/include/tcl8.5 ) - -IF(WIN32) - SET(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS} +if(WIN32) + set(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include" @@ -142,21 +141,21 @@ IF(WIN32) "C:/Program Files/Tcl/include" "C:/Tcl/include" ) -ENDIF(WIN32) +endif() -FIND_PATH(TCL_INCLUDE_PATH +find_path(TCL_INCLUDE_PATH NAMES tcl.h PATHS ${TCL_POSSIBLE_INCLUDE_PATHS} ) -IF(TCL_LIBRARY AND TCL_INCLUDE_PATH) - SET(TCL_VERSION ${TCL_VERSION}) - SET(TCL_LIBARY ${TCL_LIBRARY}) - SET(TCL_INCLUDE_PATH ${TCL_INCLUDE_PATH}) - SET(TCL_FOUND TRUE) -ENDIF(TCL_LIBRARY AND TCL_INCLUDE_PATH) +if(TCL_LIBRARY AND TCL_INCLUDE_PATH) + set(TCL_VERSION ${TCL_VERSION}) + set(TCL_LIBARY ${TCL_LIBRARY}) + set(TCL_INCLUDE_PATH ${TCL_INCLUDE_PATH}) + set(TCL_FOUND TRUE) +endif() -MARK_AS_ADVANCED( +mark_as_advanced( TCL_INCLUDE_PATH TCL_LIBRARY TCL_VERSION |