Merge lp:~gabipetrovay/zorba/curl_dll_fix into lp:zorba

Proposed by Gabriel Petrovay
Status: Merged
Approved by: Gabriel Petrovay
Approved revision: 10470
Merged at revision: 10477
Proposed branch: lp:~gabipetrovay/zorba/curl_dll_fix
Merge into: lp:zorba
Diff against target: 269 lines (+145/-35)
2 files modified
cmake_modules/Windows/FindCURL.cmake (+5/-2)
cmake_modules/Windows/ProxyFindModule.cmake (+140/-33)
To merge this branch: bzr merge lp:~gabipetrovay/zorba/curl_dll_fix
Reviewer Review Type Date Requested Status
Daniel Turcanu (community) tested Approve
Review via email: mp+76978@code.launchpad.net

Commit message

Fixing the wrong fix in FindCURL.cmake introduced in:

revno: 10390
svn revno: 11875 (on /trunk/zorba)

This fix adds a new macro to the cmake_modules/Windows/ProxyFindModule.cmake module (FIND_PACKAGE_DLL_WIN32) that allows you to search for ONLY ONE DLL but using alternate names. cURL, for example, needs this because some versions distribute curllib.dll, while others libcurl.dll.

Description of the change

This fixes the wrong fix in:

revno: 10390
svn revno: 11875 (on /trunk/zorba)
committer: ceejatec
timestamp: Sat 2011-08-27 04:42:02 +0000
message:
  Last installer fix from 2.0.0 branch; updated Changelog; bump to 2.0.1.

This fix adds a new macro to the cmake_modules/Windows/ProxyFindModule.cmake module (FIND_PACKAGE_DLL_WIN32) that allows you to search for ONLY ONE DLL but using alternate names. cURL, for example, needs this because some versions distribute curllib.dll, while others libcurl.dll.

To post a comment you must log in.
Revision history for this message
Daniel Turcanu (danielturcanu) wrote :

It compiles ok.
Didn't try with external modules.

review: Approve (tested)
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job curl_dll_fix-2011-09-28T12-05-40.187Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake_modules/Windows/FindCURL.cmake'
2--- cmake_modules/Windows/FindCURL.cmake 2011-08-27 04:42:02 +0000
3+++ cmake_modules/Windows/FindCURL.cmake 2011-09-26 13:03:54 +0000
4@@ -27,12 +27,15 @@
5 #
6 # See the FindCURL.cmake module shipped with CMake for more information.
7
8-FIND_PACKAGE_WIN32(NAME CURL FOUND_VAR CURL_FOUND SEARCH_NAMES curl)
9+FIND_PACKAGE_WIN32(NAME "CURL" FOUND_VAR "CURL_FOUND" SEARCH_NAMES "curl")
10
11 IF (CURL_FOUND)
12
13 # find the needed DLL's
14- FIND_PACKAGE_DLLS_WIN32 (${FOUND_LOCATION} "libcurl.dll;libeay32.dll;openldap.dll;ssleay32.dll")
15+ FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "libcurl" "curllib")
16+ FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "libeay32")
17+ FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "openldap")
18+ FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "ssleay32")
19
20 # find additional DLL's
21 FIND_DLL_WIN32 (libsasl.dll)
22
23=== modified file 'cmake_modules/Windows/ProxyFindModule.cmake'
24--- cmake_modules/Windows/ProxyFindModule.cmake 2011-08-19 00:03:31 +0000
25+++ cmake_modules/Windows/ProxyFindModule.cmake 2011-09-26 13:03:54 +0000
26@@ -51,24 +51,40 @@
27
28
29 # This macro will try to find a third party library on Windows.
30+# The parameters must be given the arguments using the following pattern:
31+# PARAM_NAME1 param_value1 PARAM_NAME2 param_value1 param_value2 ...
32+# This macro will further call PARSE_ARGUMENTS to parse it's arguments.
33+# In the patter above, PARAM_NAME1 will go in the single value parameter pool
34+# while PARAM_NAME2 will go in the multiple value parameter pool.
35+#
36+# Therefore the following parameter names must be provided to this macro:
37 # Parameters:
38-# NAME - the XXX in the FindXXX.cmake that is used for search
39-# e.g.: "ICU" when trying to find ICU with FindICU.cmake
40-# FOUND_VAR - the variable the FindXXX.cmake module sets if the library is found
41-# e.g.: "XERCESC_FOUND" when trying to find XercesC
42-# SEARCH_NAMES - a list of possible directory name fragments that this library can have
43-# e.g.: "icu;i_c_u;uci"
44+# NAME
45+# - mandatory, single value
46+# - the value following it will be used to build the CMake module file name.
47+# - e.g.: providing NAME "ICU" as parameters, FindICU.cmake will be used for the search.
48+# FOUND_VAR
49+# - mandatory, single value
50+# - the variable that the FindXXX.cmake module sets if the library is found
51+# - e.g.: FOUND_VAR "XERCESC_FOUND" when trying to find XercesC
52+# SEARCH_NAMES
53+# - mandatory, multiple value
54+# - the possible directory name fragments that this library can have
55+# - e.g.: SEARCH_NAMES "icu" "i_c_u" "uci"
56+# COMPONENTS
57+# - optional, multiple value
58 #
59 # Once done this will define:
60-# FOUND_LOCATION - The directory where the library was found
61+# FOUND_LOCATION - The directory where the library was found
62 #
63 MACRO (FIND_PACKAGE_WIN32)
64- PARSE_ARGUMENTS(MODULE "SEARCH_NAMES;COMPONENTS" "NAME;FOUND_VAR" "TEST_ONLY" ${ARGN})
65-
66+
67 IF (NOT WIN32)
68- MESSAGE(FATAL_ERROR "This macro is intended only for Windows platforms.")
69+ MESSAGE (FATAL_ERROR "This macro is intended only for Windows platforms.")
70 ENDIF (NOT WIN32)
71
72+ PARSE_ARGUMENTS(MODULE "SEARCH_NAMES;COMPONENTS" "NAME;FOUND_VAR" "" ${ARGN})
73+
74 IF(NOT MODULE_NAME)
75 MESSAGE (FATAL_ERROR "'NAME' argument is required")
76 ENDIF(NOT MODULE_NAME)
77@@ -185,18 +201,103 @@
78 ENDMACRO (FIND_PACKAGE_WIN32)
79
80
81-MACRO(FIND_PACKAGE_DLLS_WIN32 LIBRARY_LOCATION DLL_NAMES)
82-
83- IF (NOT WIN32)
84- MESSAGE(FATAL_ERROR "This macro is intended only for Windows platforms.")
85- ENDIF (NOT WIN32)
86+# This macro will search for a DLL in the given library location using extra
87+# arguments as alternative names of the DLL. The first DLL found with that name
88+# is considered. This is useful for some libraries that come with different DLL
89+# names depending on the library version. For example, cURL library might
90+# distribute it's main DLL with two different names: "libcurl.dll" or "curllib.dll"
91+#
92+# If the DLL is found it's full path will be added to ZORBA_REQUIRED_DLLS and
93+# it's location to the ZORBA_REQUIRED_DLL_PATHS variable. These will be later
94+# used when installing zorba.
95+#
96+MACRO (FIND_PACKAGE_DLL_WIN32 LIBRARY_LOCATION)
97+
98+ IF (NOT WIN32)
99+ MESSAGE (FATAL_ERROR "This macro is intended only for Windows platforms.")
100+ ENDIF (NOT WIN32)
101+
102+ # get the current DLLs and their paths
103+ SET (dlls "${ZORBA_REQUIRED_DLLS}")
104+ SET (paths "${ZORBA_REQUIRED_DLL_PATHS}")
105+
106+ FOREACH (NAME ${ARGN})
107+
108+ # first delete the cache entry used during FIND_FILE to make sure the correct file is chosen
109+ UNSET (TMP_DLL_VAR CACHE)
110+
111+ # find now the DLL
112+ FIND_FILE (
113+ TMP_DLL_VAR
114+ "${NAME}.dll"
115+ PATHS "${LIBRARY_LOCATION}"
116+ PATH_SUFFIXES "bin" "bin/Release"
117+ NO_DEFAULT_PATH
118+ )
119+
120+ IF (TMP_DLL_VAR)
121+
122+ LIST (APPEND dlls "${TMP_DLL_VAR}")
123+ STRING (REPLACE "/${NAME}.dll" "" PATH "${TMP_DLL_VAR}")
124+ FILE (TO_NATIVE_PATH ${PATH} NATIVE_PATH)
125+ LIST (APPEND paths "${NATIVE_PATH}")
126+ MESSAGE (STATUS "Added dll to ZORBA_REQUIRED_DLLS cache variable: ${TMP_DLL_VAR}")
127+
128+ IF (NOT ${PROJECT_NAME} STREQUAL "zorba")
129+ STRING (REPLACE "-" "_" component_name ${PROJECT_NAME})
130+ INSTALL (PROGRAMS ${TMP_DLL_VAR} DESTINATION bin COMPONENT ${component_name})
131+ ENDIF (NOT ${PROJECT_NAME} STREQUAL "zorba")
132+
133+ # we break the loop if we found one DLL
134+ BREAK ()
135+
136+ ENDIF (TMP_DLL_VAR)
137+
138+ ENDFOREACH (NAME)
139+
140+ # we report a warning if the DLL could not be found
141+ IF (NOT TMP_DLL_VAR)
142+ MESSAGE (WARNING "None of the names provided (${ARGN}) points to a DLL in: ${LIBRARY_LOCATION}. Zorba will not run properly unless you have it in the path.")
143+ ENDIF (NOT TMP_DLL_VAR)
144+
145+ # make sure we don't leave garbage in the cache and don't influence other logic with this
146+ UNSET (TMP_DLL_VAR CACHE)
147+
148+ # remove duplicates from the path list
149+ LIST (LENGTH paths LEN)
150+ IF (${LEN} GREATER 0)
151+ LIST (REMOVE_DUPLICATES paths)
152+ ENDIF (${LEN} GREATER 0)
153+
154+ # make sure we don't leave garbage in the cache and don't influence other logic with this
155+ SET (TMP_DLL_VAR TMP_DLL_VAR-NOTFOUND CACHE FILEPATH "Path to a file." FORCE)
156+
157+ IF (${PROJECT_NAME} STREQUAL "zorba")
158+ # set the current DLLs and their paths in a variable
159+ SET (ZORBA_REQUIRED_DLLS "${dlls}"
160+ CACHE STRING "List of DLLs that must be installed" FORCE
161+ )
162+ SET (ZORBA_REQUIRED_DLL_PATHS "${paths}"
163+ CACHE STRING "List of paths executable require in order to find the required DLLs" FORCE
164+ )
165+ ENDIF (${PROJECT_NAME} STREQUAL "zorba")
166+
167+ENDMACRO (FIND_PACKAGE_DLL_WIN32)
168+
169+
170+MACRO (FIND_PACKAGE_DLLS_WIN32 LIBRARY_LOCATION DLL_NAMES)
171+
172+ IF (NOT WIN32)
173+ MESSAGE (FATAL_ERROR "This macro is intended only for Windows platforms.")
174+ ENDIF (NOT WIN32)
175+
176 # get the current DLLs and their paths
177 SET (dlls "${ZORBA_REQUIRED_DLLS}")
178 SET (paths "${ZORBA_REQUIRED_DLL_PATHS}")
179
180 FOREACH (NAME ${DLL_NAMES})
181
182- # first delete the cache entry for DLL to make sure the correct one is chosen
183+ # first delete the cache entry used during FIND_FILE to make sure the correct file is chosen
184 UNSET (TMP_DLL_VAR CACHE)
185
186 # find now the DLL
187@@ -211,34 +312,34 @@
188 IF (TMP_DLL_VAR)
189 LIST (APPEND dlls "${TMP_DLL_VAR}")
190 STRING (REPLACE "/${NAME}" "" PATH "${TMP_DLL_VAR}")
191- FILE(TO_NATIVE_PATH ${PATH} NATIVE_PATH)
192+ FILE (TO_NATIVE_PATH ${PATH} NATIVE_PATH)
193 LIST (APPEND paths "${NATIVE_PATH}")
194- MESSAGE(STATUS "Added dll to ZORBA_REQUIRED_DLLS cache variable: ${TMP_DLL_VAR}")
195-
196- IF(NOT ${PROJECT_NAME} STREQUAL "zorba")
197- STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
198- INSTALL(PROGRAMS ${TMP_DLL_VAR} DESTINATION bin COMPONENT ${component_name})
199- ENDIF(NOT ${PROJECT_NAME} STREQUAL "zorba")
200-
201-
202+ MESSAGE (STATUS "Added dll to ZORBA_REQUIRED_DLLS cache variable: ${TMP_DLL_VAR}")
203+
204+ IF (NOT ${PROJECT_NAME} STREQUAL "zorba")
205+ STRING (REPLACE "-" "_" component_name ${PROJECT_NAME})
206+ INSTALL (PROGRAMS ${TMP_DLL_VAR} DESTINATION bin COMPONENT ${component_name})
207+ ENDIF (NOT ${PROJECT_NAME} STREQUAL "zorba")
208+
209 ELSE (TMP_DLL_VAR)
210- MESSAGE (WARNING "${NAME} was not found in: ${LIBRARY_LOCATION}. Zorba will not run unless you have it in the path.")
211+ MESSAGE (WARNING "${NAME} was not found in: ${LIBRARY_LOCATION}. Zorba will not run properly unless you have it in the path.")
212 ENDIF (TMP_DLL_VAR)
213-
214+
215 ENDFOREACH (NAME)
216
217 # make sure we don't leave garbage in the cache and don't influence other logic with this
218 UNSET (TMP_DLL_VAR CACHE)
219
220- LIST(LENGTH paths LEN)
221+ # remove duplicates from the path list
222+ LIST (LENGTH paths LEN)
223 IF (${LEN} GREATER 0)
224- LIST(REMOVE_DUPLICATES paths)
225+ LIST (REMOVE_DUPLICATES paths)
226 ENDIF (${LEN} GREATER 0)
227
228 # make sure we don't leave garbage in the cache and don't influence other logic with this
229 SET (TMP_DLL_VAR TMP_DLL_VAR-NOTFOUND CACHE FILEPATH "Path to a file." FORCE)
230
231- IF(${PROJECT_NAME} STREQUAL "zorba")
232+ IF (${PROJECT_NAME} STREQUAL "zorba")
233 # set the current DLLs and their paths in a variable
234 SET (ZORBA_REQUIRED_DLLS "${dlls}"
235 CACHE STRING "List of DLLs that must be installed" FORCE
236@@ -246,9 +347,9 @@
237 SET (ZORBA_REQUIRED_DLL_PATHS "${paths}"
238 CACHE STRING "List of paths executable require in order to find the required DLLs" FORCE
239 )
240- ENDIF(${PROJECT_NAME} STREQUAL "zorba")
241+ ENDIF (${PROJECT_NAME} STREQUAL "zorba")
242
243-ENDMACRO(FIND_PACKAGE_DLLS_WIN32)
244+ENDMACRO (FIND_PACKAGE_DLLS_WIN32)
245
246
247 MACRO (FIND_DLL_WIN32 DLL_NAME)
248@@ -293,6 +394,12 @@
249 # make sure we don't leave garbage in the cache and don't influence other logic with this
250 UNSET (TMP_DLL_VAR CACHE)
251
252+ # remove duplicates from the path list
253+ LIST (LENGTH paths LEN)
254+ IF (${LEN} GREATER 0)
255+ LIST (REMOVE_DUPLICATES paths)
256+ ENDIF (${LEN} GREATER 0)
257+
258 # set the current DLLs and their paths in a variable
259 SET (ZORBA_REQUIRED_DLLS "${dlls}"
260 CACHE STRING "List of DLLs that must be installed" FORCE
261@@ -307,7 +414,7 @@
262 MACRO (ADD_DLL_WIN32 DLL_PATH DLL_NAME)
263
264 IF (NOT WIN32)
265- MESSAGE(FATAL_ERROR "This macro is intended only for Windows platforms.")
266+ MESSAGE (FATAL_ERROR "This macro is intended only for Windows platforms.")
267 ENDIF (NOT WIN32)
268
269 # get the current DLLs and their paths

Subscribers

People subscribed via source and target branches