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

Proposed by Gabriel Petrovay
Status: Merged
Approved by: Gabriel Petrovay
Approved revision: 10501
Merged at revision: 10501
Proposed branch: lp:~gabipetrovay/zorba/proxy
Merge into: lp:zorba
Diff against target: 113 lines (+65/-6)
3 files modified
CMakeLists.txt (+5/-6)
cmake_modules/Windows/ProxyFindModule.cmake (+37/-0)
cmake_modules/ZorbaModule.cmake (+23/-0)
To merge this branch: bzr merge lp:~gabipetrovay/zorba/proxy
Reviewer Review Type Date Requested Status
Gabriel Petrovay (community) Approve
Review via email: mp+78753@code.launchpad.net

Commit message

Added SET_CMAKE_MODULE_PATH macro to adjust the CMAKE_MODULE_PATH in zorba module project.
Added FIND_PACKAGE_WIN32_NO_PROXY macro to search for packages on Windows that do not require guessing theie path because they are found using other means, like registry or environment variables.

Description of the change

Added SET_CMAKE_MODULE_PATH macro to adjust the CMAKE_MODULE_PATH in zorba module project.
Added FIND_PACKAGE_WIN32_NO_PROXY macro to search for packages on Windows that do not require guessing theie path because they are found using other means, like registry or environment variables.

To post a comment you must log in.
Revision history for this message
Gabriel Petrovay (gabipetrovay) :
review: Approve
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 proxy-2011-10-09T14-06-26.022Z 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 'CMakeLists.txt'
2--- CMakeLists.txt 2011-09-08 15:09:20 +0000
3+++ CMakeLists.txt 2011-10-09 14:04:07 +0000
4@@ -130,18 +130,17 @@
5 ################################################################################
6 # Various cmake macros
7
8-IF(WIN32)
9+SET (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules ${CMAKE_MODULE_PATH})
10+IF (WIN32)
11 # On Windows we use proxy modules that try to guess first the location
12 # of the required third party libraries. This will search in order in:
13 # 1. the path pointed by ZORBA_THIRD_PARTY_REQUIREMENTS
14 # 2. the Program Files directory available on the users computer
15 # 3. the PATH environment variable
16 # The logic is implemented by the macros in the ProxyFindModule.cmake module.
17- LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules/Windows")
18- INCLUDE(ProxyFindModule)
19-ENDIF(WIN32)
20-LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
21-
22+ SET (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/Windows ${CMAKE_MODULE_PATH})
23+ INCLUDE (ProxyFindModule)
24+ENDIF (WIN32)
25
26 ################################################################################
27 # This section is used for batch script generation. Each executable
28
29=== modified file 'cmake_modules/Windows/ProxyFindModule.cmake'
30--- cmake_modules/Windows/ProxyFindModule.cmake 2011-10-08 16:34:42 +0000
31+++ cmake_modules/Windows/ProxyFindModule.cmake 2011-10-09 14:04:07 +0000
32@@ -32,6 +32,15 @@
33 ENDMACRO (PRINT_FIND_END_TITLE)
34
35
36+MACRO (PRINT_FIND_END_TITLE_SYSTEM MODULE_NAME FOUND)
37+ IF (${FOUND})
38+ MESSAGE (STATUS "************* DONE (found) *************")
39+ ELSE (${FOUND})
40+ MESSAGE (STATUS "*********** DONE (not found) ***********")
41+ ENDIF (${FOUND})
42+ENDMACRO (PRINT_FIND_END_TITLE_SYSTEM)
43+
44+
45 MACRO (INSTALL_DLL DLL_PATH)
46 IF (${PROJECT_NAME} STREQUAL "zorba")
47 # for zorba core requirements, install this DLL
48@@ -213,6 +222,34 @@
49 ENDMACRO (FIND_PACKAGE_WIN32)
50
51
52+# This macro will just perform a normal library search without trying to guess
53+# locations. This should be used for searching libraries that can be found on
54+# Windows using other means like registry entries (ImageMagick) or special
55+# environment variables (Java or JNI)
56+MACRO (FIND_PACKAGE_WIN32_NO_PROXY MODULE_NAME FOUND_VAR)
57+
58+ PRINT_FIND_TITLE (${MODULE_NAME})
59+
60+ # remove the Windows module path (both from Zorba or the external modules)
61+ # to avoid an infinite recursion
62+ FOREACH (PATH ${CMAKE_MODULE_PATH})
63+ IF ("${PATH}" MATCHES ".*/cmake_modules/Windows")
64+ LIST (REMOVE_ITEM CMAKE_MODULE_PATH "${PATH}")
65+ ENDIF ("${PATH}" MATCHES ".*/cmake_modules/Windows")
66+ ENDFOREACH (PATH)
67+
68+ FIND_PACKAGE (${MODULE_NAME})
69+
70+ # restore the module path
71+ SET (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/Windows ${CMAKE_MODULE_PATH})
72+ # restore the prefix path
73+ SET (CMAKE_PREFIX_PATH ${OLD_CMAKE_PREFIX_PATH})
74+
75+ PRINT_FIND_END_TITLE_SYSTEM (${MODULE_NAME} ${FOUND_VAR})
76+
77+ENDMACRO (FIND_PACKAGE_WIN32_NO_PROXY)
78+
79+
80 # This macro will search for a DLL in the given library location using extra
81 # arguments as alternative names of the DLL. The first DLL found with that name
82 # is considered. This is useful for some libraries that come with different DLL
83
84=== modified file 'cmake_modules/ZorbaModule.cmake'
85--- cmake_modules/ZorbaModule.cmake 2011-10-09 01:15:10 +0000
86+++ cmake_modules/ZorbaModule.cmake 2011-10-09 14:04:07 +0000
87@@ -738,3 +738,26 @@
88 MESSAGE(STATUS " added test test/xqdoc/make_xqdoc")
89 MESSAGE(STATUS "ADD_XQDOC_TARGETS END")
90 ENDMACRO(ADD_XQDOC_TARGETS)
91+
92+
93+# Macro that takes care of the CMake module path in a project. This will prepend
94+# "cmake_modules" and "cmake_modules/Windows" to the existing CMAKE_MODULE_PATH
95+MACRO (SET_CMAKE_MODULE_PATH)
96+
97+ # first we prepend the "cmake_modules" directory in the project root
98+ SET (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules ${CMAKE_MODULE_PATH})
99+
100+ # now we prepend the "cmake_modules/Windows" directory in the project root
101+ # this takes care about the finding and installing DLL for these libraries
102+ IF (WIN32)
103+ # Since the user can install libraries on Windows at any location we use
104+ # proxy modules that try to guess first the location of the required third
105+ # party libraries. This will search in order in:
106+ # 1. the path pointed by ZORBA_THIRD_PARTY_REQUIREMENTS
107+ # 2. the Program Files directory available on the users computer
108+ # 3. the PATH environment variable
109+ # The logic is implemented by the macros in the ProxyFindModule.cmake module.
110+ SET (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/Windows ${CMAKE_MODULE_PATH})
111+ ENDIF (WIN32)
112+
113+ENDMACRO (SET_CMAKE_MODULE_PATH)

Subscribers

People subscribed via source and target branches