map_toolsConfig.cmake 8.8 KB

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