Add gtest support.

This commit is contained in:
kradchen
2023-05-05 16:48:34 +08:00
parent 2fffb7cd08
commit 0693bda970

View File

@@ -7,8 +7,24 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Aurora REQUIRED)
file(GLOB_RECURSE cpp_files ./src/*.cpp)
file(GLOB_RECURSE cxx_files ./src/*.cxx)
add_executable(UR ${cpp_files} ${cxx_files} ${Aurora_Source})
file(GLOB_RECURSE header_files ./src/*.h)
add_executable(UR ${cpp_files} ${cxx_files} ${header_files} ${Aurora_Source})
target_compile_options(UR PUBLIC ${Aurora_Complie_Options})
target_include_directories(UR PUBLIC ${Aurora_INCLUDE_DIRS})
target_link_libraries(UR PUBLIC ${Aurora_Libraries})
target_link_libraries(UR PUBLIC matio)
target_link_libraries(UR PUBLIC matio)
find_package(GTest REQUIRED)
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
file(GLOB_RECURSE test_cpp ./test/*.cpp)
enable_testing()
add_executable(UR_Test ${cpp_files} ${header_files} ${Aurora_Source} ${test_cpp} )
target_include_directories(UR_Test PUBLIC ./test/ ./src/)
target_compile_options(UR_Test PUBLIC ${Aurora_Complie_Options})
target_include_directories(UR_Test PUBLIC ${Aurora_INCLUDE_DIRS})
target_link_libraries(UR_Test PUBLIC ${Aurora_Libraries})
target_link_libraries(UR_Test PUBLIC matio)
target_link_libraries(UR_Test PUBLIC ${GTEST_BOTH_LIBRARIES})
gtest_discover_tests(UR_Test )