How to properly include Qt5Core static library, with using CMake in android studio project?

Viewed 231

I have problem when I link C++ static library in android studio. It is Native C++ android studio project and static library is linked.

The static library depends on Qt5Core library, so I have also included the needed library libQt5Core.a for all ABI, same way like my library:

CMakeLists.txt

add_library(Qt5Core STATIC IMPORTED)
set_target_properties(Qt5Core PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libQt5Core.a)

I placed my headers from the library in app\src\main\cpp\include. And I included them in native-lib.cpp file:

#include "include/MyLib/testingclass.h"

And the problem is that I get error: fatal error: 'QList' file not found

Because I am using it in my library like this:

 #include <QList>

I am beginner at CMake and I think that I need to include the header files from QtCore in my project. Thanks in advance.

I have tried to solve it like this:

I have copied C:\Qt\5.13.1\android_static\include\Qt5Core in this location app\src\main\cpp\include and I changed #include <QList> to #include "include/QtCore/QList" but still got error that can't be found.

UPDATE: Another try instead of linking the static library, I tried this which still give QList not found error:

set(Qt5_DIR "C:\\Qt\\5.13.1\\android_static\\lib\\cmake\\Qt5\\")
set(Qt5Core_DIR "C:\\Qt\\5.13.1\\android_static\\lib\\cmake\\Qt5Core\\")
find_package(Qt5 REQUIRED COMPONENTS Core)
0 Answers
Related