-
Notifications
You must be signed in to change notification settings - Fork 20
Adds if check around calling catkin_add_gmock #43
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,8 @@ macro(find_catkin) | |
endmacro() | ||
|
||
macro(find_common_test_packages) | ||
# Loads the proper testing package (either catkin or ament) depending on what's available during | ||
# the build | ||
find_catkin() | ||
find_package(ament_cmake_gtest QUIET) | ||
if(catkin_FOUND) | ||
|
@@ -37,6 +39,12 @@ macro(find_common_test_packages) | |
message(WARNING "Could not find catkin or ament!") | ||
endif() | ||
|
||
if(CATKIN_ENABLE_TESTING OR BUILD_TESTING) | ||
set(aws_common_TESTING_ENABLED 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but I was trying to give the variable some sort of namespace to indicate where it comes from. Multiple packages use |
||
else() | ||
set(aws_common_TESTING_ENABLED 0) | ||
endif() | ||
|
||
if(DEFINED GMOCK_LIBRARIES) | ||
set(GMOCK_LIBRARY ${GMOCK_LIBRARIES}) | ||
else() | ||
|
@@ -48,7 +56,9 @@ macro(add_common_gtest target) | |
if(catkin_FOUND) | ||
message(STATUS "Building tests using catkin") | ||
set(GTEST_LIBRARIES "") # hack so that linking against libgmock doesn't also link against libgtest | ||
catkin_add_gmock("${target}" ${ARGN}) | ||
if(CATKIN_ENABLE_TESTING) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be using CATKIN_ENABLE_TESTING only when |
||
catkin_add_gmock("${target}" ${ARGN}) | ||
endif() | ||
elseif(ament_cmake_gtest_FOUND) | ||
message(STATUS "Building tests using ament") | ||
ament_add_gmock("${target}" ${ARGN}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good idea.
In the
CMakeLists.txt
of our ROS packages, they are guardedCATKIN_ENABLE_TESTING
.It makes sense for our ROS-less packages to be guarded by a similar variable (that's derived from catkin and ament testing variables).
In the same vein, our ROS2 packages should be made to do something similar as well.