Skip to content

Commit

Permalink
common_test: add test_executable variable
Browse files Browse the repository at this point in the history
This makes the cmake code more readable.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Dec 2, 2022
1 parent a01ff7c commit 42aec9e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/common_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ endfunction()
set(GZ_PHYSICS_RESOURCE_DIR "${CMAKE_SOURCE_DIR}/resources")

foreach(test ${tests})
add_executable(${TEST_TYPE}_${test} ${test}.cc)
set(test_executable "${TEST_TYPE}_${test}")
add_executable(${test_executable} ${test}.cc)

target_link_libraries(${TEST_TYPE}_${test}
target_link_libraries(${test_executable}
PUBLIC
gz-plugin${GZ_PLUGIN_VER}::loader
gz-common${GZ_COMMON_VER}::gz-common${GZ_COMMON_VER}
Expand All @@ -39,17 +40,17 @@ foreach(test ${tests})
${PROJECT_NAME}_test_lib_loader
)

target_compile_definitions(${TEST_TYPE}_${test} PRIVATE
target_compile_definitions(${test_executable} PRIVATE
"TEST_WORLD_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/worlds/\""
"GZ_PHYSICS_RESOURCE_DIR=\"${GZ_PHYSICS_RESOURCE_DIR}\""
)

if (${BULLET_FOUND})
configure_common_test("bullet" ${TEST_TYPE}_${test})
configure_common_test("bullet-featherstone" ${TEST_TYPE}_${test})
configure_common_test("bullet" ${test_executable})
configure_common_test("bullet-featherstone" ${test_executable})
endif()
if (${DART_FOUND})
configure_common_test("dartsim" ${TEST_TYPE}_${test})
configure_common_test("dartsim" ${test_executable})
endif()
configure_common_test("tpe" ${TEST_TYPE}_${test})
configure_common_test("tpe" ${test_executable})
endforeach()

0 comments on commit 42aec9e

Please sign in to comment.