summaryrefslogtreecommitdiff
blob: 5c03a45f155bd0adc9449d72af02fb6cf2901f26 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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.16/cmake/all.cmake
===================================================================
--- catkin-0.6.16.orig/cmake/all.cmake
+++ catkin-0.6.16/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.16/python/catkin/workspace.py
===================================================================
--- catkin-0.6.16.orig/python/catkin/workspace.py
+++ catkin-0.6.16/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.16/cmake/catkinConfig.cmake.in
===================================================================
--- catkin-0.6.16.orig/cmake/catkinConfig.cmake.in
+++ catkin-0.6.16/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)
Index: catkin-0.6.16/cmake/toplevel.cmake
===================================================================
--- catkin-0.6.16.orig/cmake/toplevel.cmake
+++ catkin-0.6.16/cmake/toplevel.cmake
@@ -35,10 +35,15 @@ else()
       string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
     endif()
   endif()
+  if(NOT DEFINED CATKIN_PREFIX_PATH)
+    if(NOT "$ENV{CATKIN_PREFIX_PATH}" STREQUAL "")
+      string(REPLACE ":" ";" CATKIN_PREFIX_PATH $ENV{CATKIN_PREFIX_PATH})
+    endif()
+  endif()
 
   # list of catkin workspaces
   set(catkin_search_path "")
-  foreach(path ${CMAKE_PREFIX_PATH})
+  foreach(path ${CMAKE_PREFIX_PATH} ${CATKIN_PREFIX_PATH})
     if(EXISTS "${path}/.catkin")
       list(FIND catkin_search_path ${path} _index)
       if(_index EQUAL -1)