Skip to content

Commit

Permalink
Add target list
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalkah committed Oct 31, 2023
1 parent 4710428 commit 0be7079
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 75 deletions.
15 changes: 14 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,27 @@
"tasks": [
{
"type": "cmake",
"label": "CMake: build all",
"label": "CMake: build test",
"command": "build",
"targets": [
"test_bfs",
"test_dfs",
"test_a_star",
"test_map",
"test_access_data",
"test_rrt",
"test_rrt_star",
],
"group": "build",
"problemMatcher": [],
"detail": "CMake template build task"
},
{
"type": "cmake",
"label": "CMake: build main",
"command": "build",
"targets": [
"main",
],
"group": "build",
"problemMatcher": [],
Expand Down
85 changes: 11 additions & 74 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,88 +17,25 @@ FetchContent_Declare(
# set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

add_executable(
set(TARGET_LIST
test_map
test_map.cpp
)

add_executable(
test_a_star
test_a_star.cpp
)

add_executable(
test_bfs
test_bfs.cpp
)

add_executable(
test_dfs
test_dfs.cpp
)

add_executable(
test_access_data
test_access_data.cpp
)

add_executable(
test_rrt_star
test_rrt_star.cpp
)

add_executable(
test_rrt
test_rrt.cpp
)

target_link_libraries(
test_map
common_grid_base
GTest::gtest_main
)

target_link_libraries(
test_a_star
a_star
GTest::gtest_main
)

target_link_libraries(
test_bfs
bfs
GTest::gtest_main
)

target_link_libraries(
test_dfs
dfs
GTest::gtest_main
)

target_link_libraries(
test_access_data
common_grid_base
GTest::gtest_main
)

target_link_libraries(
test_rrt_star
rrt_star
GTest::gtest_main
)

target_link_libraries(
test_rrt
rrt
GTest::gtest_main
)
foreach(TARGET ${TARGET_LIST})
add_executable(${TARGET} ${TARGET}.cpp)
target_link_libraries(${TARGET} GTest::gtest_main common_grid_base a_star bfs dfs rrt_star rrt)
add_test(NAME ${TARGET} COMMAND ${TARGET})

endforeach()

include(GoogleTest)
gtest_discover_tests(test_map)
gtest_discover_tests(test_a_star)
gtest_discover_tests(test_bfs)
gtest_discover_tests(test_dfs)
gtest_discover_tests(test_access_data)
gtest_discover_tests(test_rrt_star)
gtest_discover_tests(test_rrt)

foreach(TARGET ${TARGET_LIST})
gtest_discover_tests(${TARGET})
endforeach()

0 comments on commit 0be7079

Please sign in to comment.