Prepare GMock support for Noetic. (#1499)

This follows Cartographer installing libgmock-dev.

Signed-off-by: Wolfgang Hess <whess@lyft.com>
master
Wolfgang Hess 2020-07-27 19:45:40 +02:00 committed by GitHub
parent ec29019962
commit 0228078e1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -49,6 +49,7 @@ include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake")
option(BUILD_GRPC "build features that require Cartographer gRPC support" false) option(BUILD_GRPC "build features that require Cartographer gRPC support" false)
google_initialize_cartographer_project() google_initialize_cartographer_project()
google_enable_testing() google_enable_testing()
set(CARTOGRAPHER_GMOCK_LIBRARIES ${GMOCK_LIBRARIES})
find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES}) find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES})
@ -72,7 +73,7 @@ include_directories(
# Override Catkin's GTest configuration to use GMock. # Override Catkin's GTest configuration to use GMock.
set(GTEST_FOUND TRUE) set(GTEST_FOUND TRUE)
set(GTEST_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}) set(GTEST_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS})
set(GTEST_LIBRARIES ${GMOCK_LIBRARIES}) set(GTEST_LIBRARIES ${CARTOGRAPHER_GMOCK_LIBRARIES})
catkin_package( catkin_package(
CATKIN_DEPENDS CATKIN_DEPENDS
@ -152,6 +153,7 @@ if (CATKIN_ENABLE_TESTING)
catkin_add_gtest(${TEST_NAME} ${TEST_SOURCE_FILENAME}) catkin_add_gtest(${TEST_NAME} ${TEST_SOURCE_FILENAME})
# catkin_add_gtest uses a plain (i.e. no PUBLIC/PRIVATE/INTERFACE) call to # catkin_add_gtest uses a plain (i.e. no PUBLIC/PRIVATE/INTERFACE) call to
# target_link_libraries. That forces us to do the same. # target_link_libraries. That forces us to do the same.
target_link_libraries(${TEST_NAME} ${GMOCK_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
target_include_directories(${TEST_NAME} SYSTEM PUBLIC ${LUA_INCLUDE_DIR}) target_include_directories(${TEST_NAME} SYSTEM PUBLIC ${LUA_INCLUDE_DIR})
target_link_libraries(${TEST_NAME} ${LUA_LIBRARIES}) target_link_libraries(${TEST_NAME} ${LUA_LIBRARIES})
target_include_directories(${TEST_NAME} SYSTEM PUBLIC ${catkin_INCLUDE_DIRS}) target_include_directories(${TEST_NAME} SYSTEM PUBLIC ${catkin_INCLUDE_DIRS})

View File

@ -21,6 +21,12 @@ set -o verbose
sudo apt-get update sudo apt-get update
sudo apt-get install -y lsb-release cmake ninja-build stow sudo apt-get install -y lsb-release cmake ninja-build stow
# Install GMock library and header files for newer distributions.
if [[ "$(lsb_release -sc)" = "focal" || "$(lsb_release -sc)" = "buster" ]]
then
sudo apt-get install -y libgmock-dev
fi
. /opt/ros/${ROS_DISTRO}/setup.sh . /opt/ros/${ROS_DISTRO}/setup.sh
cd catkin_ws cd catkin_ws