diff --git a/test/src/gtest_demo/CMakeLists.txt b/test/src/gtest_demo/CMakeLists.txt new file mode 100644 index 0000000..4a0b39d --- /dev/null +++ b/test/src/gtest_demo/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.19) +project(gtest_demo) + +message("cmake module " $ENV{CMAKE_MODULE_PATH}) +message("project dir " ${PROJECT_SOURCE_DIR}) + +set(CMAKE_BUILD_TYPE DEBUG) + +set(CMAKE_CXX_FLAGS "/OPT:NOREF /MTd /std:c++14 /EHsc /MTd") +set(CMAKE_CXX_FLAGS_RELEASE "") + + +include_directories(E:\\conan_data\\gtest\\1.0\\_\\_\\package\\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\\include) +link_directories(E:\\conan_data\\gtest\\1.0\\_\\_\\package\\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\\lib) + +link_libraries(gtestd.lib gtest_maind.lib gmockd.lib gmock_maind.lib) +add_executable(gtest_demo gtest_demo.cpp) + +set_property(TARGET gtest_demo PROPERTY + MSVC_RUNTIME_LIBRARY MultiThreadedDebug) + + target_include_directories(gtest_demo SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../obj/inc/third/include) diff --git a/test/src/gtest_demo/gtest_demo.cpp b/test/src/gtest_demo/gtest_demo.cpp new file mode 100644 index 0000000..75ccd5c --- /dev/null +++ b/test/src/gtest_demo/gtest_demo.cpp @@ -0,0 +1,13 @@ +#include + + +int add(int a,int b){ + return a+b; +} +TEST(testCase,test0){ + EXPECT_EQ(add(2,3),5); +} +int main(int argc,char **argv){ + testing::InitGoogleTest(&argc,argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file