Skip to content

Commit

Permalink
Update testing CMake for new GoogleTest
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <michael@openrobotics.org>
  • Loading branch information
mjcarroll committed May 31, 2022
1 parent b03ab61 commit d1cee8c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
16 changes: 10 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
include_directories(
${PROJECT_SOURCE_DIR}/test/gtest/include
${PROJECT_SOURCE_DIR}/test/gtest
${PROJECT_SOURCE_DIR}/test
)

# Build gtest
add_library(gtest STATIC gtest/src/gtest-all.cc)
add_library(gtest_main STATIC gtest/src/gtest_main.cc)
target_include_directories(gtest
SYSTEM PUBLIC
${PROJECT_SOURCE_DIR}/test/gtest/include
${PROJECT_SOURCE_DIR}/test/gtest
)

target_link_libraries(gtest_main gtest)
set_property(TARGET gtest_main PROPERTY CXX_STANDARD ${c++standard})
set_property(TARGET gtest PROPERTY CXX_STANDARD ${c++standard})
set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a")
set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a")

execute_process(COMMAND cmake -E remove_directory ${CMAKE_BINARY_DIR}/test_results)
execute_process(COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test_results)

add_subdirectory(integration)
add_subdirectory(performance)
add_subdirectory(regression)
Expand Down
1 change: 1 addition & 0 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ign_build_tests(
TYPE INTEGRATION
SOURCES ${tests}
LIB_DEPS ignition-common${IGN_COMMON_VER}-testing
INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/test
)

if(TARGET INTEGRATION_plugin)
Expand Down
3 changes: 2 additions & 1 deletion test/performance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ link_directories(${PROJECT_BINARY_DIR}/test)

ign_build_tests(
TYPE PERFORMANCE
SOURCES ${tests})
SOURCES ${tests}
INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/test)

if(TARGET PERFORMANCE_plugin_specialization)
# We add this dependency to make sure that DummyPlugins gets generated
Expand Down

0 comments on commit d1cee8c

Please sign in to comment.