Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions cmake/common/find_or_add_gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,6 @@
# limitations under the License.

macro(find_or_add_gtest)
# Check if building on an ament context, i.e. ROS 2
# Thanks to https://github.com/facontidavide/PlotJuggler/blob/main/CMakeLists.txt#L66
find_package(ament_cmake QUIET)

# This is a ROS 2 build
if(ament_cmake_FOUND)
# Find all GTest vendor required packages
find_package(ament_cmake REQUIRED)
find_package(gtest_vendor REQUIRED)
find_package(ament_cmake_gtest REQUIRED)

# Find GTest
ament_find_gtest()

# Add aliases for GTest libraries so we can use them as targets independently of the context
add_library(GTest::gtest ALIAS gtest)
add_library(GTest::gtest_main ALIAS gtest_main)
target_link_libraries(gtest_main gtest)

# This is a non-ROS 2 build
else()
# Find GTest normally
find_package(GTest CONFIG REQUIRED)
endif()
# Find GTest normally
find_package(GTest CONFIG REQUIRED)
endmacro()
3 changes: 0 additions & 3 deletions colcon.pkg
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: fastcdr
type: cmake
test-dependencies:
# Needed for test compilation in ROS 2 CI
- ament_cmake_gtest
- ament_cmake
# Needed for test compilation in eProsima CI
- googletest-distribution
3 changes: 1 addition & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<buildtool_depend>cmake</buildtool_depend>
<doc_depend>doxygen</doc_depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_cmake</test_depend>
<test_depend>libgtest-dev</test_depend>

<export>
<build_type>cmake</build_type>
Expand Down
Loading