Inner classes with tests in Python unit tests will not be tested (Problem of Python Unittest framework)
pkg-config is available for locating gtest and gmock. A valid CMakeList.txt file could look like this:
cmake_minimum_required(VERSION 3.14)
project(runTests)
# GoogleTest requires at least C++11
set(CMAKE_CXX_STANDARD 11)
## Locate GTest and GMock
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTEST REQUIRED gtest)
pkg_check_modules(GMOCK REQUIRED gmock)
include_directories(
${GTEST_INCLUDE_DIRS}
${GMOCK_INCLUDE_DIRS}
)
## Link runTests with libraries
add_executable(runTests tests.cpp x.cpp)
target_link_libraries(runTests ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} pthread)
Alternative CMakeList.txt file for gtest only:
cmake_minimum_required(VERSION 3.14)
project(runTests)
# Locate GTest
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
# Link runTests with what we want to test and the GTest and pthread library
add_executable(runTests tests.cpp)
target_link_libraries(runTests ${GTEST_LIBRARIES} pthread)