Skip to content

Commit

Permalink
GzBuildTests: apply patch from #334
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored and j-rivero committed May 8, 2023
1 parent 06247ce commit 32dacf7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmake/GzBuildTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
# SOURCES <sources>
# [LIB_DEPS <library_dependencies>]
# [INCLUDE_DIRS <include_dependencies>]
# [TEST_LIST <output_var>])
# [TEST_LIST <output_var>]
# [ENVIRONMENT <environment>])
#
# Build tests for a Gazebo project. Arguments are as follows:
#
Expand All @@ -41,6 +42,8 @@
# will also skip the step of copying the runtime library
# into your executable's directory.
#
# ENVIRONMENT: Optional. Used to set the ENVIRONMENT property of the tests.
#
macro(ign_build_tests)
message(WARNING "ign_build_tests is deprecated, use gz_build_tests instead.")

Expand All @@ -60,7 +63,7 @@ macro(gz_build_tests)
# Define the expected arguments
set(options SOURCE EXCLUDE_PROJECT_LIB) # NOTE: DO NOT USE "SOURCE", we're adding it here to catch typos
set(oneValueArgs TYPE TEST_LIST)
set(multiValueArgs SOURCES LIB_DEPS INCLUDE_DIRS)
set(multiValueArgs SOURCES LIB_DEPS INCLUDE_DIRS ENVIRONMENT)

#------------------------------------
# Parse the arguments
Expand Down Expand Up @@ -132,6 +135,10 @@ macro(gz_build_tests)
add_test(NAME ${target_name} COMMAND
${target_name} --gtest_output=xml:${CMAKE_BINARY_DIR}/test_results/${target_name}.xml)

if(gz_build_tests_ENVIRONMENT)
set_property(TEST ${target_name} PROPERTY ENVIRONMENT ${gz_build_tests_ENVIRONMENT})
endif()

if(UNIX)
# gtest requies pthread when compiled on a Unix machine
target_link_libraries(${target_name} pthread)
Expand Down

0 comments on commit 32dacf7

Please sign in to comment.