summaryrefslogtreecommitdiff
blob: 94e23ee0d98e6f41b3216fc3beabb2bdf07b81f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Allow CATKIN_PREFIX_PATH to override/complement CMAKE_PREFIX_PATH.
This serves two goals: when SYSROOT!=/, CMAKE_PREFIX_PATH is the same as when
SYSROOT=/ but we need to find packages in SYSROOT/CMAKE_PREFIX_PATH.

Moreover, this allows to set CATKIN_PREFIX_PATH in global environment so that
ROS packages are properly configured without needed to source a shellrc file in
every shell session. This can't be done with CMAKE_PREFIX_PATH which is way too
generic.

Index: catkin-0.6.9/cmake/all.cmake
===================================================================
--- catkin-0.6.9.orig/cmake/all.cmake
+++ catkin-0.6.9/cmake/all.cmake
@@ -52,7 +52,11 @@ set(CMAKE_PREFIX_PATH_AS_IS ${CMAKE_PREF
 
 # list of unique catkin workspaces based on CMAKE_PREFIX_PATH
 set(CATKIN_WORKSPACES "")
-foreach(path ${CMAKE_PREFIX_PATH})
+if(NOT DEFINED CATKIN_PREFIX_PATH)
+  set(CATKIN_PREFIX_PATH ${CMAKE_PREFIX_PATH})
+endif()
+
+foreach(path ${CATKIN_PREFIX_PATH})
   if(EXISTS "${path}/.catkin")
     list(FIND CATKIN_WORKSPACES ${path} _index)
     if(_index EQUAL -1)
Index: catkin-0.6.11/python/catkin/workspace.py
===================================================================
--- catkin-0.6.11.orig/python/catkin/workspace.py
+++ catkin-0.6.11/python/catkin/workspace.py
@@ -44,7 +44,7 @@ def get_workspaces():
     """
     # get all cmake prefix paths
     env_name = 'CMAKE_PREFIX_PATH'
-    paths = [path for path in os.environ.get(env_name, '').split(os.pathsep) if path]
+    paths = [path for path in os.environ.get(env_name, '').split(os.pathsep) + os.environ.get('CATKIN_PREFIX_PATH', '').split(os.pathsep) if path]
     # remove non-workspace paths
     workspaces = [path for path in paths if os.path.isfile(os.path.join(path, CATKIN_MARKER_FILE))]
     return workspaces
Index: catkin-0.6.9/cmake/catkinConfig.cmake.in
===================================================================
--- catkin-0.6.9.orig/cmake/catkinConfig.cmake.in
+++ catkin-0.6.9/cmake/catkinConfig.cmake.in
@@ -64,6 +64,11 @@ if(catkin_FIND_COMPONENTS)
 
       # get search paths from CMAKE_PREFIX_PATH (which includes devel space)
       set(paths "")
+      foreach(path ${CATKIN_PREFIX_PATH})
+        if(IS_DIRECTORY ${path}/share/${component}/cmake)
+          list(APPEND paths ${path}/share/${component}/cmake)
+        endif()
+      endforeach()
       foreach(path ${CMAKE_PREFIX_PATH})
         if(IS_DIRECTORY ${path}/share/${component}/cmake)
           list(APPEND paths ${path}/share/${component}/cmake)