]> git.leonardobizzoni.com Git - pioneer-stm32/blob
1ea39b1b3021fd347e0e453288469368c4d72d61
[pioneer-stm32] /
1 # generated from catkin/cmake/template/pkgConfig.cmake.in
2
3 # append elements to a list and remove existing duplicates from the list
4 # copied from catkin/cmake/list_append_deduplicate.cmake to keep pkgConfig
5 # self contained
6 macro(_list_append_deduplicate listname)
7   if(NOT "${ARGN}" STREQUAL "")
8     if(${listname})
9       list(REMOVE_ITEM ${listname} ${ARGN})
10     endif()
11     list(APPEND ${listname} ${ARGN})
12   endif()
13 endmacro()
14
15 # append elements to a list if they are not already in the list
16 # copied from catkin/cmake/list_append_unique.cmake to keep pkgConfig
17 # self contained
18 macro(_list_append_unique listname)
19   foreach(_item ${ARGN})
20     list(FIND ${listname} ${_item} _index)
21     if(_index EQUAL -1)
22       list(APPEND ${listname} ${_item})
23     endif()
24   endforeach()
25 endmacro()
26
27 # pack a list of libraries with optional build configuration keywords
28 # copied from catkin/cmake/catkin_libraries.cmake to keep pkgConfig
29 # self contained
30 macro(_pack_libraries_with_build_configuration VAR)
31   set(${VAR} "")
32   set(_argn ${ARGN})
33   list(LENGTH _argn _count)
34   set(_index 0)
35   while(${_index} LESS ${_count})
36     list(GET _argn ${_index} lib)
37     if("${lib}" MATCHES "^(debug|optimized|general)$")
38       math(EXPR _index "${_index} + 1")
39       if(${_index} EQUAL ${_count})
40         message(FATAL_ERROR "_pack_libraries_with_build_configuration() the list of libraries '${ARGN}' ends with '${lib}' which is a build configuration keyword and must be followed by a library")
41       endif()
42       list(GET _argn ${_index} library)
43       list(APPEND ${VAR} "${lib}${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}${library}")
44     else()
45       list(APPEND ${VAR} "${lib}")
46     endif()
47     math(EXPR _index "${_index} + 1")
48   endwhile()
49 endmacro()
50
51 # unpack a list of libraries with optional build configuration keyword prefixes
52 # copied from catkin/cmake/catkin_libraries.cmake to keep pkgConfig
53 # self contained
54 macro(_unpack_libraries_with_build_configuration VAR)
55   set(${VAR} "")
56   foreach(lib ${ARGN})
57     string(REGEX REPLACE "^(debug|optimized|general)${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}(.+)$" "\\1;\\2" lib "${lib}")
58     list(APPEND ${VAR} "${lib}")
59   endforeach()
60 endmacro()
61
62
63 if(joypad_bridge_CONFIG_INCLUDED)
64   return()
65 endif()
66 set(joypad_bridge_CONFIG_INCLUDED TRUE)
67
68 # set variables for source/devel/install prefixes
69 if("FALSE" STREQUAL "TRUE")
70   set(joypad_bridge_SOURCE_PREFIX /home/fdila/Projects/otto/utils/ticks_calibration/catkin_ws/src/joypad_bridge)
71   set(joypad_bridge_DEVEL_PREFIX /home/fdila/Projects/otto/utils/ticks_calibration/catkin_ws/devel)
72   set(joypad_bridge_INSTALL_PREFIX "")
73   set(joypad_bridge_PREFIX ${joypad_bridge_DEVEL_PREFIX})
74 else()
75   set(joypad_bridge_SOURCE_PREFIX "")
76   set(joypad_bridge_DEVEL_PREFIX "")
77   set(joypad_bridge_INSTALL_PREFIX /home/fdila/Projects/otto/utils/ticks_calibration/catkin_ws/install)
78   set(joypad_bridge_PREFIX ${joypad_bridge_INSTALL_PREFIX})
79 endif()
80
81 # warn when using a deprecated package
82 if(NOT "" STREQUAL "")
83   set(_msg "WARNING: package 'joypad_bridge' is deprecated")
84   # append custom deprecation text if available
85   if(NOT "" STREQUAL "TRUE")
86     set(_msg "${_msg} ()")
87   endif()
88   message("${_msg}")
89 endif()
90
91 # flag project as catkin-based to distinguish if a find_package()-ed project is a catkin project
92 set(joypad_bridge_FOUND_CATKIN_PROJECT TRUE)
93
94 if(NOT " " STREQUAL " ")
95   set(joypad_bridge_INCLUDE_DIRS "")
96   set(_include_dirs "")
97   if(NOT " " STREQUAL " ")
98     set(_report "Check the issue tracker '' and consider creating a ticket if the problem has not been reported yet.")
99   elseif(NOT " " STREQUAL " ")
100     set(_report "Check the website '' for information and consider reporting the problem.")
101   else()
102     set(_report "Report the problem to the maintainer 'fdila <fdila@todo.todo>' and request to fix the problem.")
103   endif()
104   foreach(idir ${_include_dirs})
105     if(IS_ABSOLUTE ${idir} AND IS_DIRECTORY ${idir})
106       set(include ${idir})
107     elseif("${idir} " STREQUAL "include ")
108       get_filename_component(include "${joypad_bridge_DIR}/../../../include" ABSOLUTE)
109       if(NOT IS_DIRECTORY ${include})
110         message(FATAL_ERROR "Project 'joypad_bridge' specifies '${idir}' as an include dir, which is not found.  It does not exist in '${include}'.  ${_report}")
111       endif()
112     else()
113       message(FATAL_ERROR "Project 'joypad_bridge' specifies '${idir}' as an include dir, which is not found.  It does neither exist as an absolute directory nor in '\${prefix}/${idir}'.  ${_report}")
114     endif()
115     _list_append_unique(joypad_bridge_INCLUDE_DIRS ${include})
116   endforeach()
117 endif()
118
119 set(libraries "")
120 foreach(library ${libraries})
121   # keep build configuration keywords, target names and absolute libraries as-is
122   if("${library}" MATCHES "^(debug|optimized|general)$")
123     list(APPEND joypad_bridge_LIBRARIES ${library})
124   elseif(${library} MATCHES "^-l")
125     list(APPEND joypad_bridge_LIBRARIES ${library})
126   elseif(${library} MATCHES "^-")
127     # This is a linker flag/option (like -pthread)
128     # There's no standard variable for these, so create an interface library to hold it
129     if(NOT joypad_bridge_NUM_DUMMY_TARGETS)
130       set(joypad_bridge_NUM_DUMMY_TARGETS 0)
131     endif()
132     # Make sure the target name is unique
133     set(interface_target_name "catkin::joypad_bridge::wrapped-linker-option${joypad_bridge_NUM_DUMMY_TARGETS}")
134     while(TARGET "${interface_target_name}")
135       math(EXPR joypad_bridge_NUM_DUMMY_TARGETS "${joypad_bridge_NUM_DUMMY_TARGETS}+1")
136       set(interface_target_name "catkin::joypad_bridge::wrapped-linker-option${joypad_bridge_NUM_DUMMY_TARGETS}")
137     endwhile()
138     add_library("${interface_target_name}" INTERFACE IMPORTED)
139     if("${CMAKE_VERSION}" VERSION_LESS "3.13.0")
140       set_property(
141         TARGET
142         "${interface_target_name}"
143         APPEND PROPERTY
144         INTERFACE_LINK_LIBRARIES "${library}")
145     else()
146       target_link_options("${interface_target_name}" INTERFACE "${library}")
147     endif()
148     list(APPEND joypad_bridge_LIBRARIES "${interface_target_name}")
149   elseif(TARGET ${library})
150     list(APPEND joypad_bridge_LIBRARIES ${library})
151   elseif(IS_ABSOLUTE ${library})
152     list(APPEND joypad_bridge_LIBRARIES ${library})
153   else()
154     set(lib_path "")
155     set(lib "${library}-NOTFOUND")
156     # since the path where the library is found is returned we have to iterate over the paths manually
157     foreach(path /home/fdila/Projects/otto/utils/ticks_calibration/catkin_ws/install/lib;/home/fdila/Projects/otto/utils/ticks_calibration/catkin_ws/devel/lib;/opt/ros/melodic/lib)
158       find_library(lib ${library}
159         PATHS ${path}
160         NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
161       if(lib)
162         set(lib_path ${path})
163         break()
164       endif()
165     endforeach()
166     if(lib)
167       _list_append_unique(joypad_bridge_LIBRARY_DIRS ${lib_path})
168       list(APPEND joypad_bridge_LIBRARIES ${lib})
169     else()
170       # as a fall back for non-catkin libraries try to search globally
171       find_library(lib ${library})
172       if(NOT lib)
173         message(FATAL_ERROR "Project '${PROJECT_NAME}' tried to find library '${library}'.  The library is neither a target nor built/installed properly.  Did you compile project 'joypad_bridge'?  Did you find_package() it before the subdirectory containing its code is included?")
174       endif()
175       list(APPEND joypad_bridge_LIBRARIES ${lib})
176     endif()
177   endif()
178 endforeach()
179
180 set(joypad_bridge_EXPORTED_TARGETS "")
181 # create dummy targets for exported code generation targets to make life of users easier
182 foreach(t ${joypad_bridge_EXPORTED_TARGETS})
183   if(NOT TARGET ${t})
184     add_custom_target(${t})
185   endif()
186 endforeach()
187
188 set(depends "")
189 foreach(depend ${depends})
190   string(REPLACE " " ";" depend_list ${depend})
191   # the package name of the dependency must be kept in a unique variable so that it is not overwritten in recursive calls
192   list(GET depend_list 0 joypad_bridge_dep)
193   list(LENGTH depend_list count)
194   if(${count} EQUAL 1)
195     # simple dependencies must only be find_package()-ed once
196     if(NOT ${joypad_bridge_dep}_FOUND)
197       find_package(${joypad_bridge_dep} REQUIRED NO_MODULE)
198     endif()
199   else()
200     # dependencies with components must be find_package()-ed again
201     list(REMOVE_AT depend_list 0)
202     find_package(${joypad_bridge_dep} REQUIRED NO_MODULE ${depend_list})
203   endif()
204   _list_append_unique(joypad_bridge_INCLUDE_DIRS ${${joypad_bridge_dep}_INCLUDE_DIRS})
205
206   # merge build configuration keywords with library names to correctly deduplicate
207   _pack_libraries_with_build_configuration(joypad_bridge_LIBRARIES ${joypad_bridge_LIBRARIES})
208   _pack_libraries_with_build_configuration(_libraries ${${joypad_bridge_dep}_LIBRARIES})
209   _list_append_deduplicate(joypad_bridge_LIBRARIES ${_libraries})
210   # undo build configuration keyword merging after deduplication
211   _unpack_libraries_with_build_configuration(joypad_bridge_LIBRARIES ${joypad_bridge_LIBRARIES})
212
213   _list_append_unique(joypad_bridge_LIBRARY_DIRS ${${joypad_bridge_dep}_LIBRARY_DIRS})
214   list(APPEND joypad_bridge_EXPORTED_TARGETS ${${joypad_bridge_dep}_EXPORTED_TARGETS})
215 endforeach()
216
217 set(pkg_cfg_extras "")
218 foreach(extra ${pkg_cfg_extras})
219   if(NOT IS_ABSOLUTE ${extra})
220     set(extra ${joypad_bridge_DIR}/${extra})
221   endif()
222   include(${extra})
223 endforeach()