summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-02-01 19:46:23 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-02-01 19:46:23 (GMT)
commita98f99a820cecae802d68400b2485706ae8d9e0b (patch)
tree1c1b6ecc87b1e8d161cbde230a38acc3dd2195e1 /Modules
parentb7fd02422985cf4bf4e2ab2676b08fcbbf6ffdc9 (diff)
parente01fe583b80208b1cd28f429cfac9c866453a994 (diff)
downloadCMake-a98f99a820cecae802d68400b2485706ae8d9e0b.zip
CMake-a98f99a820cecae802d68400b2485706ae8d9e0b.tar.gz
CMake-a98f99a820cecae802d68400b2485706ae8d9e0b.tar.bz2
Merge topic 'improve-findtclsh'
e01fe58 FindTclsh: support version selection
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindTCL.cmake12
-rw-r--r--Modules/FindTclsh.cmake12
2 files changed, 19 insertions, 5 deletions
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 13f32f8..f2c776f 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -48,10 +48,14 @@ INCLUDE(CMakeFindFrameworks)
INCLUDE(FindTclsh)
INCLUDE(FindWish)
-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}")
+IF(TCLSH_VERSION_STRING)
+ SET(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
+ELSE(TCLSH_VERSION_STRING)
+ 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}")
+ENDIF(TCLSH_VERSION_STRING)
GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
index 8fde59e..a45f285 100644
--- a/Modules/FindTclsh.cmake
+++ b/Modules/FindTclsh.cmake
@@ -82,9 +82,19 @@ FIND_PROGRAM(TCL_TCLSH
HINTS ${TCLTK_POSSIBLE_BIN_PATHS}
)
+IF(TCL_TCLSH)
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version"
+ COMMAND "${TCL_TCLSH}"
+ OUTPUT_VARIABLE TCLSH_VERSION_STRING
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF(TCL_TCLSH)
+
# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh DEFAULT_MSG TCL_TCLSH)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh
+ REQUIRED_VARS TCL_TCLSH
+ VERSION_VAR TCLSH_VERSION_STRING)
MARK_AS_ADVANCED(TCL_TCLSH)