openbsd-ports/devel/cmake/patches/patch-Modules_FindTCL_cmake
dcoppa 3f852fbc8f Bugfix update to cmake-2.8.10.2.
Sync patches with what has been committed upstream (kudos to Amit)
2012-12-05 11:32:04 +00:00

226 lines
6.0 KiB
Plaintext

$OpenBSD: patch-Modules_FindTCL_cmake,v 1.7 2012/12/05 11:32:04 dcoppa Exp $
--- Modules/FindTCL.cmake.orig Tue Nov 27 14:26:32 2012
+++ Modules/FindTCL.cmake Wed Dec 5 10:21:21 2012
@@ -48,19 +48,36 @@ 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})
+
if(TCLSH_VERSION_STRING)
set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
-else()
+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()
+ 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)
+endif(TCLSH_VERSION_STRING)
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)
@@ -75,15 +92,35 @@ 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"
- )
+set(TCLTK_OPENBSD_LIB_PATHS)
+if(MODTCL_LIBDIR)
+ list(APPEND TCLTK_OPENBSD_LIB_PATHS "${MODTCL_LIBDIR}")
+endif()
+
+if(MODTK_LIBDIR)
+ list(APPEND TCLTK_OPENBSD_LIB_PATHS "${MODTK_LIBDIR}")
+endif()
+
+if(NOT "${TCLTK_OPENBSD_LIB_PATHS}" STREQUAL "")
+ set(TCLTK_POSSIBLE_LIB_PATHS
+ "${TCLTK_OPENBSD_LIB_PATHS}"
+ )
+else()
+ 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"
+ ${LOCALBASE}/lib/tcl/tcl8.5
+ ${LOCALBASE}/lib/tcl/tk8.5
+ ${LOCALBASE}/lib/tcl/tcl8.4
+ ${LOCALBASE}/lib/tcl/tk8.4
+ )
+endif()
+
if(WIN32)
get_filename_component(
ActiveTcl_CurrentVersion
@@ -103,31 +140,47 @@ if(WIN32)
)
endif()
-find_library(TCL_LIBRARY
- NAMES
- tcl
- tcl${TCL_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${TCL_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${TK_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${TK_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)
@@ -151,24 +204,44 @@ if(Tk_FRAMEWORKS)
endif()
endif()
-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/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
- )
+set(TCLTK_OPENBSD_INCLUDE_PATHS)
+
+if(MODTCL_INCDIR)
+ list(APPEND TCLTK_OPENBSD_INCLUDE_PATHS "${MODTCL_INCDIR}")
+endif()
+
+if(MODTK_INCDIR)
+ list(APPEND TCLTK_OPENBSD_INCLUDE_PATHS "${MODTK_INCDIR}")
+endif()
+
+if(NOT "${TCLTK_OPENBSD_INCLUDE_PATHS}" STREQUAL "")
+ set(TCLTK_POSSIBLE_INCLUDE_PATHS
+ "${TCLTK_OPENBSD_INCLUDE_PATHS}"
+ )
+else()
+ 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/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
+ ${LOCALBASE}/include/tcl8.5
+ ${LOCALBASE}/include/tk8.5
+ ${LOCALBASE}/include/tcl8.4
+ ${LOCALBASE}/include/tk8.4
+ )
+endif()
if(WIN32)
set(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}