No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # toplevel CMakeLists.txt for a catkin workspace
  2. # catkin/cmake/toplevel.cmake
  3. cmake_minimum_required(VERSION 2.8.3)
  4. set(CATKIN_TOPLEVEL TRUE)
  5. # search for catkin within the workspace
  6. set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}")
  7. execute_process(COMMAND ${_cmd}
  8. RESULT_VARIABLE _res
  9. OUTPUT_VARIABLE _out
  10. ERROR_VARIABLE _err
  11. OUTPUT_STRIP_TRAILING_WHITESPACE
  12. ERROR_STRIP_TRAILING_WHITESPACE
  13. )
  14. if(NOT _res EQUAL 0 AND NOT _res EQUAL 2)
  15. # searching fot catkin resulted in an error
  16. string(REPLACE ";" " " _cmd_str "${_cmd}")
  17. message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}")
  18. endif()
  19. # include catkin from workspace or via find_package()
  20. if(_res EQUAL 0)
  21. set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake")
  22. # include all.cmake without add_subdirectory to let it operate in same scope
  23. include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE)
  24. add_subdirectory("${_out}")
  25. else()
  26. # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument
  27. # or CMAKE_PREFIX_PATH from the environment
  28. if(NOT DEFINED CMAKE_PREFIX_PATH)
  29. if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
  30. if(NOT WIN32)
  31. string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
  32. else()
  33. set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
  34. endif()
  35. endif()
  36. endif()
  37. # list of catkin workspaces
  38. set(catkin_search_path "")
  39. foreach(path ${CMAKE_PREFIX_PATH})
  40. if(EXISTS "${path}/.catkin")
  41. list(FIND catkin_search_path ${path} _index)
  42. if(_index EQUAL -1)
  43. list(APPEND catkin_search_path ${path})
  44. endif()
  45. endif()
  46. endforeach()
  47. # search for catkin in all workspaces
  48. set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE)
  49. find_package(catkin QUIET
  50. NO_POLICY_SCOPE
  51. PATHS ${catkin_search_path}
  52. NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  53. unset(CATKIN_TOPLEVEL_FIND_PACKAGE)
  54. if(NOT catkin_FOUND)
  55. message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.")
  56. endif()
  57. endif()
  58. catkin_workspace()