I am trying to integrate GTest to my existing project. Below is my following project structure:
--trunk(folder)
--sources(folder)
--Prj1
--Prj2
--CMakeLists.txt
--test(folder)
--test1(folder)
--test1.h
--test1.cpp
--main.cpp
--CMakeLists.txt(1)
--test2(folder)
--test2.h
--test2.cpp
--main.cpp
--CMakeLists.txt(2)
--CMakeLists.txt(3)
--CMakeLists.txt
Now i want to integerate the GTest for this project. I would have probably 10 tests to be carried out. i would like to know the best way to write /integrate my project.
CMakeList.txt(1)
cmake_minimum_required(VERSION 2.6)
add_test(dummy dummy)
add_executable(dummy main.cpp test1.cpp test1.h)
target_link_libraries(dummy gtest gtest_main)
CMakeList.txt(3)
find_package(Threads REQUIRED)
ADD_SUBDIRECTORY ("C:/gtest/1.7.0"${CMAKE_CURRENT_BINARY_DIR}/gtest")
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_subdirectory(test)
main.cpp
#include<gtest/gtest.h>
int main(int argc, char* argv[])
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
With this i am able to create gtest and gtest_main librabry, but would like to create only one time and link them with all the tests. And moreover i would like to have the test in a folder view in my visual studio project. Could anyone help me to achieve this