waypoint_makerConfig.cmake 9.6 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(waypoint_maker_CONFIG_INCLUDED)
  58. return()
  59. endif()
  60. set(waypoint_maker_CONFIG_INCLUDED TRUE)
  61. # set variables for source/devel/install prefixes
  62. if("FALSE" STREQUAL "TRUE")
  63. set(waypoint_maker_SOURCE_PREFIX /home/neousys/autoware.ai/src/autoware/core_planning/waypoint_maker)
  64. set(waypoint_maker_DEVEL_PREFIX /home/neousys/autoware.ai/build/waypoint_maker/devel)
  65. set(waypoint_maker_INSTALL_PREFIX "")
  66. set(waypoint_maker_PREFIX ${waypoint_maker_DEVEL_PREFIX})
  67. else()
  68. set(waypoint_maker_SOURCE_PREFIX "")
  69. set(waypoint_maker_DEVEL_PREFIX "")
  70. set(waypoint_maker_INSTALL_PREFIX /home/neousys/autoware.ai/install/waypoint_maker)
  71. set(waypoint_maker_PREFIX ${waypoint_maker_INSTALL_PREFIX})
  72. endif()
  73. # warn when using a deprecated package
  74. if(NOT "" STREQUAL "")
  75. set(_msg "WARNING: package 'waypoint_maker' 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(waypoint_maker_FOUND_CATKIN_PROJECT TRUE)
  84. if(NOT " " STREQUAL " ")
  85. set(waypoint_maker_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 'h_ohta <h_ohta@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 "${waypoint_maker_DIR}/../../../include" ABSOLUTE)
  99. if(NOT IS_DIRECTORY ${include})
  100. message(FATAL_ERROR "Project 'waypoint_maker' 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 'waypoint_maker' 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(waypoint_maker_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 waypoint_maker_LIBRARIES ${library})
  113. elseif(${library} MATCHES "^-l")
  114. list(APPEND waypoint_maker_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 waypoint_maker_NUM_DUMMY_TARGETS)
  119. set(waypoint_maker_NUM_DUMMY_TARGETS 0)
  120. endif()
  121. # Make sure the target name is unique
  122. set(interface_target_name "catkin::waypoint_maker::wrapped-linker-option${waypoint_maker_NUM_DUMMY_TARGETS}")
  123. while(TARGET "${interface_target_name}")
  124. math(EXPR waypoint_maker_NUM_DUMMY_TARGETS "${waypoint_maker_NUM_DUMMY_TARGETS}+1")
  125. set(interface_target_name "catkin::waypoint_maker::wrapped-linker-option${waypoint_maker_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 waypoint_maker_LIBRARIES "${interface_target_name}")
  138. elseif(TARGET ${library})
  139. list(APPEND waypoint_maker_LIBRARIES ${library})
  140. elseif(IS_ABSOLUTE ${library})
  141. list(APPEND waypoint_maker_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/waypoint_maker/lib;/home/neousys/autoware.ai/install/lane_planner/lib;/home/neousys/autoware.ai/install/libwaypoint_follower/lib;/home/neousys/autoware.ai/install/lanelet2_extension/lib;/home/neousys/autoware.ai/install/vector_map/lib;/home/neousys/autoware.ai/install/amathutils_lib/lib;/home/neousys/autoware.ai/install/vector_map_msgs/lib;/home/neousys/autoware.ai/install/tablet_socket_msgs/lib;/home/neousys/autoware.ai/install/gnss/lib;/home/neousys/autoware.ai/install/autoware_msgs/lib;/home/neousys/autoware.ai/install/autoware_lanelet2_msgs/lib;/home/neousys/autoware.ai/install/autoware_config_msgs/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(waypoint_maker_LIBRARY_DIRS ${lib_path})
  157. list(APPEND waypoint_maker_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 'waypoint_maker'? Did you find_package() it before the subdirectory containing its code is included?")
  163. endif()
  164. list(APPEND waypoint_maker_LIBRARIES ${lib})
  165. endif()
  166. endif()
  167. endforeach()
  168. set(waypoint_maker_EXPORTED_TARGETS "")
  169. # create dummy targets for exported code generation targets to make life of users easier
  170. foreach(t ${waypoint_maker_EXPORTED_TARGETS})
  171. if(NOT TARGET ${t})
  172. add_custom_target(${t})
  173. endif()
  174. endforeach()
  175. set(depends "")
  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 waypoint_maker_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 ${waypoint_maker_dep}_FOUND)
  184. find_package(${waypoint_maker_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(${waypoint_maker_dep} REQUIRED NO_MODULE ${depend_list})
  190. endif()
  191. _list_append_unique(waypoint_maker_INCLUDE_DIRS ${${waypoint_maker_dep}_INCLUDE_DIRS})
  192. # merge build configuration keywords with library names to correctly deduplicate
  193. _pack_libraries_with_build_configuration(waypoint_maker_LIBRARIES ${waypoint_maker_LIBRARIES})
  194. _pack_libraries_with_build_configuration(_libraries ${${waypoint_maker_dep}_LIBRARIES})
  195. _list_append_deduplicate(waypoint_maker_LIBRARIES ${_libraries})
  196. # undo build configuration keyword merging after deduplication
  197. _unpack_libraries_with_build_configuration(waypoint_maker_LIBRARIES ${waypoint_maker_LIBRARIES})
  198. _list_append_unique(waypoint_maker_LIBRARY_DIRS ${${waypoint_maker_dep}_LIBRARY_DIRS})
  199. list(APPEND waypoint_maker_EXPORTED_TARGETS ${${waypoint_maker_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 ${waypoint_maker_DIR}/${extra})
  205. endif()
  206. include(${extra})
  207. endforeach()