Skip to content

Instantly share code, notes, and snippets.

@dirk-thomas
Created July 7, 2015 20:09
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dirk-thomas/a76f952d05e7b21b0128 to your computer and use it in GitHub Desktop.
Save dirk-thomas/a76f952d05e7b21b0128 to your computer and use it in GitHub Desktop.
CMakeLists.txt example with ament auto
cmake_minimum_required(VERSION 2.8.3)
project(foo)
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
endif()
# find dependencies
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
# message generation
ament_auto_generate_code()
# setup targets
ament_auto_add_library(foo_lib src/lib.cpp)
ament_auto_add_executable(foo_bin src/bin.cpp)
# export information to downstream packages
ament_auto_package(
CONFIG_EXTRAS "foo-extras.cmake"
)
# tests
if(AMENT_ENABLE_TESTING)
find_package(ament_cmake_gtest REQUIRED)
ament_add_gtest(foo_gtest test/my_test.cpp)
target_link_libraries(foo_gtest ${rclcpp_LIBRARIES} ${rmw_connext_cpp_LIBRARIES} ${std_interfaces})
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment