I use Android Studio to build simple application with c++ support. Now I want to write unittest for functions in my native lib. How can I include google test in my CMakeLists.txt to build and run my tests on Android device?
When I put
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo ${GTEST_BOTH_LIBRARIES})
add_test(AllTestsInFoo foo)
in CMakeLists.txt I've go an error that GTest is not found.
I saw this and this questions. And the documentation, but they all are about .mk files not about CMakeLists.txt
How should I find googletest library on android device and link my test project with it?
Maybe i should write my own CMakeLists.txt for sourses located in
${ANDROID_NDK}/sources/third_party/googletest
to apply paches and build this library by myself?