$OpenBSD: patch-Modules_FindTCL_cmake,v 1.1 2010/05/28 20:21:48 dcoppa Exp $ --- Modules/FindTCL.cmake.orig Tue Apr 6 16:45:31 2010 +++ Modules/FindTCL.cmake Tue May 11 13:54:34 2010 @@ -48,15 +48,32 @@ INCLUDE(CMakeFindFrameworks) INCLUDE(FindTclsh) INCLUDE(FindWish) +SET(MODTCL_VERSION $ENV{MODTCL_VERSION}) +SET(MODTK_VERSION $ENV{MODTK_VERSION}) +SET(MODTCL_INCDIR $ENV{MODTCL_INCDIR}) +SET(MODTK_INCDIR $ENV{MODTK_INCDIR}) +SET(MODTCL_LIB $ENV{MODTCL_LIB}) +SET(MODTK_LIB $ENV{MODTK_LIB}) +SET(MODTCL_LIBDIR $ENV{MODTCL_LIBDIR}) +SET(MODTK_LIBDIR $ENV{MODTK_LIBDIR}) + 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(MODTCL_VERSION) + SET(TCL_TCLSH_VERSION "${MODTCL_VERSION}") +ELSE(MODTCL_VERSION) + STRING(REGEX REPLACE + "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}") +ENDIF(MODTCL_VERSION) GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH) GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) -STRING(REGEX REPLACE - "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}") +IF(MODTK_VERSION) + SET(TK_WISH_VERSION "${MODTK_VERSION}") +ELSE(MODTK_VERSION) + STRING(REGEX REPLACE + "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}") +ENDIF(MODTK_VERSION) GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH) GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH) @@ -71,17 +88,37 @@ GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LI STRING(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}") -SET(TCLTK_POSSIBLE_LIB_PATHS - "${TCL_INCLUDE_PATH_PARENT}/lib" - "${TK_INCLUDE_PATH_PARENT}/lib" - "${TCL_LIBRARY_PATH}" - "${TK_LIBRARY_PATH}" - "${TCL_TCLSH_PATH_PARENT}/lib" - "${TK_WISH_PATH_PARENT}/lib" - /usr/lib - /usr/local/lib - ) +IF(MODTCL_LIBDIR) + SET(TCLTK_OPENBSD_LIB_PATHS + "${TCLTK_OPENBSD_LIB_PATHS}" + "${MODTCL_LIBDIR}" + ) +ENDIF(MODTCL_LIBDIR) +IF(MODTK_LIBDIR) + SET(TCLTK_OPENBSD_LIB_PATHS + "${TCLTK_OPENBSD_LIB_PATHS}" + "${MODTK_LIBDIR}" + ) +ENDIF(MODTK_LIBDIR) + +IF(TCLTK_OPENBSD_LIB_PATHS) + SET(TCLTK_POSSIBLE_LIB_PATHS + "${TCLTK_OPENBSD_LIB_PATHS}" + ) +ELSE(TCLTK_OPENBSD_LIB_PATHS) + SET(TCLTK_POSSIBLE_LIB_PATHS + "${TCL_INCLUDE_PATH_PARENT}/lib" + "${TK_INCLUDE_PATH_PARENT}/lib" + "${TCL_LIBRARY_PATH}" + "${TK_LIBRARY_PATH}" + "${TCL_TCLSH_PATH_PARENT}/lib" + "${TK_WISH_PATH_PARENT}/lib" + /usr/lib + /usr/local/lib + ) +ENDIF(TCLTK_OPENBSD_LIB_PATHS) + IF(WIN32) GET_FILENAME_COMPONENT( ActiveTcl_CurrentVersion @@ -101,31 +138,47 @@ IF(WIN32) ) ENDIF(WIN32) -FIND_LIBRARY(TCL_LIBRARY - NAMES - tcl - tcl${TK_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION} - tcl86 tcl8.6 - tcl85 tcl8.5 - tcl84 tcl8.4 - tcl83 tcl8.3 - tcl82 tcl8.2 - tcl80 tcl8.0 - PATHS ${TCLTK_POSSIBLE_LIB_PATHS} - ) +IF(MODTCL_LIB) + FIND_LIBRARY(TCL_LIBRARY + NAMES + ${MODTCL_LIB} + PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + ) +ELSE(MODTCL_LIB) + FIND_LIBRARY(TCL_LIBRARY + NAMES + tcl + tcl${TK_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION} + tcl86 tcl8.6 + tcl85 tcl8.5 + tcl84 tcl8.4 + tcl83 tcl8.3 + tcl82 tcl8.2 + tcl80 tcl8.0 + PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + ) +ENDIF(MODTCL_LIB) -FIND_LIBRARY(TK_LIBRARY - NAMES - tk - tk${TCL_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION} - tk86 tk8.6 - tk85 tk8.5 - tk84 tk8.4 - tk83 tk8.3 - tk82 tk8.2 - tk80 tk8.0 - PATHS ${TCLTK_POSSIBLE_LIB_PATHS} - ) +IF(MODTK_LIB) + FIND_LIBRARY(TK_LIBRARY + NAMES + ${MODTK_LIB} + PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + ) +ELSE(MODTK_LIB) + FIND_LIBRARY(TK_LIBRARY + NAMES + tk + tk${TCL_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION} + tk86 tk8.6 + tk85 tk8.5 + tk84 tk8.4 + tk83 tk8.3 + tk82 tk8.2 + tk80 tk8.0 + PATHS ${TCLTK_POSSIBLE_LIB_PATHS} + ) +ENDIF(MODTK_LIB) CMAKE_FIND_FRAMEWORKS(Tcl) CMAKE_FIND_FRAMEWORKS(Tk) @@ -149,26 +202,46 @@ IF(Tk_FRAMEWORKS) ENDIF(NOT TK_INCLUDE_PATH) ENDIF(Tk_FRAMEWORKS) -SET(TCLTK_POSSIBLE_INCLUDE_PATHS - "${TCL_LIBRARY_PATH_PARENT}/include" - "${TK_LIBRARY_PATH_PARENT}/include" - "${TCL_INCLUDE_PATH}" - "${TK_INCLUDE_PATH}" - ${TCL_FRAMEWORK_INCLUDES} - ${TK_FRAMEWORK_INCLUDES} - "${TCL_TCLSH_PATH_PARENT}/include" - "${TK_WISH_PATH_PARENT}/include" - /usr/include - /usr/local/include - /usr/include/tcl${TK_LIBRARY_VERSION} - /usr/include/tcl${TCL_LIBRARY_VERSION} - /usr/include/tcl8.6 - /usr/include/tcl8.5 - /usr/include/tcl8.4 - /usr/include/tcl8.3 - /usr/include/tcl8.2 - /usr/include/tcl8.0 - ) +IF(MODTCL_INCDIR) + SET(TCLTK_OPENBSD_INCLUDE_PATHS + "${TCLTK_OPENBSD_INCLUDE_PATHS}" + "${MODTCL_INCDIR}" + ) +ENDIF(MODTCL_INCDIR) + +IF(MODTK_INCDIR) + SET(TCLTK_OPENBSD_INCLUDE_PATHS + "${TCLTK_OPENBSD_INCLUDE_PATHS}" + "${MODTK_INCDIR}" + ) +ENDIF(MODTK_INCDIR) + +IF(TCLTK_OPENBSD_INCLUDE_PATHS) + SET(TCLTK_POSSIBLE_INCLUDE_PATHS + "${TCLTK_OPENBSD_INCLUDE_PATHS}" + ) +ELSE(TCLTK_OPENBSD_INCLUDE_PATHS) + SET(TCLTK_POSSIBLE_INCLUDE_PATHS + "${TCL_LIBRARY_PATH_PARENT}/include" + "${TK_LIBRARY_PATH_PARENT}/include" + "${TCL_INCLUDE_PATH}" + "${TK_INCLUDE_PATH}" + ${TCL_FRAMEWORK_INCLUDES} + ${TK_FRAMEWORK_INCLUDES} + "${TCL_TCLSH_PATH_PARENT}/include" + "${TK_WISH_PATH_PARENT}/include" + /usr/include + /usr/local/include + /usr/include/tcl${TK_LIBRARY_VERSION} + /usr/include/tcl${TCL_LIBRARY_VERSION} + /usr/include/tcl8.6 + /usr/include/tcl8.5 + /usr/include/tcl8.4 + /usr/include/tcl8.3 + /usr/include/tcl8.2 + /usr/include/tcl8.0 + ) +ENDIF(TCLTK_OPENBSD_INCLUDE_PATHS) IF(WIN32) SET(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}