Skip to content

Commit

Permalink
perf: remove gtest things and optimize Test
Browse files Browse the repository at this point in the history
Signed-off-by: msclock <msclock@qq.com>
  • Loading branch information
msclock committed Apr 4, 2024
1 parent 6be6556 commit bc91801
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 55 deletions.
55 changes: 0 additions & 55 deletions cmake/test/GoogleTest.cmake

This file was deleted.

33 changes: 33 additions & 0 deletions cmake/test/Test.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#[[
Enable tests in CMake, and use CTest module to create a ``BUILD_TESTING``
option to select whether to enable tests.

Note:
Use the module has some requirements:
- Being placed in front of test configuration instructions in cmake.
- Being placed in the source directory root because ctest expects to
find a test file in the build directory root.
]]

include_guard(GLOBAL)

# Prevent the module from being used in the wrong location
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(
FATAL_ERROR
"This module should be in the project root directory and placed "
"in front of any test configuration instructions in cmake")
endif()

# Include CTest module to enable testing support. It creates a ``BUILD_TESTING``
# option that selects whether to enable testing support (``ON`` by default).
include(CTest)

function(add_test_subdirectory src)
if(NOT IS_ABSOLUTE src)
cmake_path(ABSOLUTE_PATH src BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE src)
endif()
message(STATUS "Adding tests from ${src}")
add_subdirectory(${src})
endfunction()

0 comments on commit bc91801

Please sign in to comment.