0002793: BinOcaf: low performance saving documents with large attributes
[occt.git] / adm / templates / tcl.cmake
CommitLineData
ad211ad3 1# - Find Tcl includes and libraries
2
3IF(WIN32)
4 SET(TCL_SEP "")
5
6 GET_FILENAME_COMPONENT(ActiveTcl_CurrentVersion
7 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]" NAME)
8
9ELSE()
10 SET(TCL_SEP ".")
11ENDIF()
12
13IF(NOT DEFINED 3RDPARTY_TCL_DIR)
14 SET(3RDPARTY_TCL_DIR "" CACHE PATH "Directory contains TCL product")
15ENDIF()
16
17IF(3RDPARTY_DIR AND ("${3RDPARTY_TCL_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
18 FIND_PRODUCT_DIR("${3RDPARTY_DIR}" tcl TCL_DIR_NAME)
19 IF("${TCL_DIR_NAME}" STREQUAL "")
20 MESSAGE(STATUS "\nInfo: tcl folder isn't found in ${3RDPARTY_DIR}. Start seeking in default folders")
21 ELSE()
22 SET(3RDPARTY_TCL_DIR "${3RDPARTY_DIR}/${TCL_DIR_NAME}" CACHE PATH "Directory contains TCL product" FORCE)
23 ENDIF()
24ENDIF()
25
26SET(INSTALL_TCL OFF CACHE BOOL "Is TCL lib copy to install directory")
27
28# include dir search
29IF("${3RDPARTY_TCL_INCLUDE_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_TCL_INCLUDE_DIR}" STREQUAL "3RDPARTY_TCL_INCLUDE_DIR-NOTFOUND")
30 SET(3RDPARTY_TCL_INCLUDE_DIR "3RDPARTY_TCL_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "Directory contains headers of the TCL product" FORCE)
31
32 IF(NOT "${3RDPARTY_TCL_DIR}" STREQUAL "")
33 FIND_PATH(3RDPARTY_TCL_INCLUDE_DIR tcl.h PATHS "${3RDPARTY_TCL_DIR}/include" NO_DEFAULT_PATH)
34 ELSE()
35 SET(3RDPARTY_TCL_POSSIBLE_INCLUDE_DIRS /usr/include
36 /usr/local/include
37 /usr/include/tcl8${TCL_SEP}6
38 /usr/include/tcl8${TCL_SEP}5)
39 IF(WIN32)
40 SET(3RDPARTY_TCL_POSSIBLE_INCLUDE_DIRS ${3RDPARTY_TCL_POSSIBLE_INCLUDE_DIRS}
41 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include"
42 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include"
43 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include"
44 "$ENV{ProgramFiles}/Tcl/include"
45 #"$ENV{ProgramFiles\(x86\)}/Tcl/include"
46 "C:/Program Files/Tcl/include"
47 "C:/Tcl/include")
48 ENDIF(WIN32)
49
50 # check default path (with additions) for header search
51 FIND_PATH(3RDPARTY_TCL_INCLUDE_DIR tcl.h PATHS ${3RDPARTY_TCL_POSSIBLE_INCLUDE_DIRS})
52
53 #if find_path found something - set 3RDPARTY_TCL_DIR
54 IF(NOT "${3RDPARTY_TCL_INCLUDE_DIR}" STREQUAL "3RDPARTY_TCL_INCLUDE_DIR-NOTFOUND")
55 GET_FILENAME_COMPONENT (3RDPARTY_TCL_DIR "${3RDPARTY_TCL_INCLUDE_DIR}/../" ABSOLUTE)
56 SET(3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DIR} CACHE FILEPATH "Directory contains TCL product" FORCE)
57 ENDIF()
58 ENDIF()
59ENDIF()
60
61#library dir search
62IF("${3RDPARTY_TCL_LIBRARY}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_TCL_LIBRARY}" STREQUAL "3RDPARTY_TCL_LIBRARY-NOTFOUND")
63 SET(3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "Path to library of the TCL product" FORCE)
64
65 IF(NOT "${3RDPARTY_TCL_DIR}" STREQUAL "")
66 FIND_LIBRARY(3RDPARTY_TCL_LIBRARY
67 NAMES tcl tcl8${TCL_SEP}6 tcl8${TCL_SEP}5
68 PATHS "${3RDPARTY_TCL_DIR}/lib" NO_DEFAULT_PATH)
69 ELSE()
70 SET(3RDPARTY_TCL_POSSIBLE_LIBRARIES_DIRS /usr/lib /usr/local/lib)
71
72 IF(WIN32)
73 SET(3RDPARTY_TCL_POSSIBLE_LIBRARIES_DIRS ${3RDPARTY_TCL_POSSIBLE_LIBRARIES_DIRS}
74 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib"
75 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib"
76 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib"
77 "$ENV{ProgramFiles}/Tcl/Lib"
78 "C:/Program Files/Tcl/lib"
79 "C:/Tcl/lib" )
80 ENDIF()
81
82 # check default path (with additions) for library search
83 FIND_LIBRARY(3RDPARTY_TCL_LIBRARY
84 NAMES tcl tcl8${TCL_SEP}6 tcl8${TCL_SEP}5
85 PATHS ${3RDPARTY_TCL_POSSIBLE_LIBRARIES_DIRS})
86 ENDIF()
87ENDIF()
88
89#search the version of found tcl library
90IF("${3RDPARTY_TCL_LIBRARY}" STREQUAL "" OR "${3RDPARTY_TCL_LIBRARY}" STREQUAL "3RDPARTY_TCL_LIBRARY-NOTFOUND")
91 SET (TCL_DLL_SO_NAMES ${DLL_SO_PREFIX}tcl.${DLL_SO}
92 ${DLL_SO_PREFIX}tcl8${TCL_SEP}5.${DLL_SO}
93 ${DLL_SO_PREFIX}tcl8${TCL_SEP}6.${DLL_SO} )
94ELSE()
95 GET_FILENAME_COMPONENT(TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
96
97 STRING(REGEX REPLACE "^.*tcl([0-9])[^0-9]*[0-9].*$" "\\1" TCL_MAJOR_VERSION "${TCL_LIBRARY_NAME}")
98 STRING(REGEX REPLACE "^.*tcl[0-9][^0-9]*([0-9]).*$" "\\1" TCL_MINOR_VERSION "${TCL_LIBRARY_NAME}")
99
100 IF (NOT "${TCL_MAJOR_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
101 SET (IS_TCL_VERSION_FOUND ON)
102 ELSE()
103 SET (IS_TCL_VERSION_FOUND OFF)
104 ENDIF()
105
106 IF (IS_TCL_VERSION_FOUND)
107 SET (TCL_DLL_SO_NAMES "${DLL_SO_PREFIX}tcl${TCL_MAJOR_VERSION}${TCL_SEP}${TCL_MINOR_VERSION}.${DLL_SO}")
108 ELSE()
109 MESSAGE(STATUS "\nWarning: Tcl version isn't found. ${DLL_SO_PREFIX}tcl.${DLL_SO} is used")
110 SET (TCL_DLL_SO_NAMES "${DLL_SO_PREFIX}tcl.${DLL_SO}")
111 ENDIF()
112ENDIF()
113
114#dll_so search
115IF("${3RDPARTY_TCL_DLL}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_TCL_DLL}" STREQUAL "3RDPARTY_TCL_DLL-NOTFOUND")
116 SET(3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "Path to shared library of the TCL product" FORCE)
117
118 IF(NOT "${3RDPARTY_TCL_DIR}" STREQUAL "")
119 FIND_FILE(3RDPARTY_TCL_DLL
120 NAMES ${TCL_DLL_SO_NAMES}
121 PATHS "${3RDPARTY_TCL_DIR}/${DLL_SO_FOLDER}" NO_DEFAULT_PATH)
122 ELSE()
123 SET(3RDPARTY_TCL_POSSIBLE_SO_DIRS /usr/lib /usr/local/lib)
124
125 IF(WIN32)
126 SET(3RDPARTY_TCL_POSSIBLE_SO_DIRS ${3RDPARTY_TCL_POSSIBLE_SO_DIRS}
127 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin"
128 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin"
129 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin"
130 "$ENV{ProgramFiles}/Tcl/Bin"
131 "C:/Program Files/Tcl/bin"
132 "C:/Tcl/b" )
133 ENDIF()
134
135 # check default path (with additions) for dll_so search
136 FIND_FILE(3RDPARTY_TCL_DLL
137 NAMES ${TCL_DLL_SO_NAMES}
138 PATHS ${3RDPARTY_TCL_POSSIBLE_SO_DIRS})
139 ENDIF()
140ENDIF()
141
142IF(NOT "${3RDPARTY_TCL_DIR}" STREQUAL "")
143 MARK_AS_ADVANCED(3RDPARTY_TCL_DIR)
144ENDIF()
145
146# #includes found paths to common variables
147IF(3RDPARTY_TCL_INCLUDE_DIR)
148 SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_TCL_INCLUDE_DIR}")
149ELSE()
150 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
151ENDIF()
152
153IF(3RDPARTY_TCL_LIBRARY)
154 GET_FILENAME_COMPONENT(3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
155SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_TCL_LIBRARY_DIR}")
156ELSE()
157 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY)
158ENDIF()
159
160IF(3RDPARTY_TCL_DLL)
161ELSE()
162 LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL)
ad211ad3 163ENDIF()