-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: remove gtest things and optimize Test
Signed-off-by: msclock <msclock@qq.com>
- Loading branch information
Showing
2 changed files
with
33 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |