CMake在Android Studio上找不到Qt5Widgets

时间:2017-08-23 00:19:26

标签: java qt android-studio cmake qt5

我使用的是Android Studio 2.3.2,我想在应用程序中实现一个Qt项目,但是在构建项目时遇到了问题。这是CMakeLists.txt:

 # For more information about using CMake with Android Studio, read the
 # documentation: https://d.android.com/studio/projects/add-native-code.html

 # Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

#QMake implementation

find_package(Qt5Widgets)
find_package(Qt5Declarative)

list(APPEND THIRD_PARTY_LIBS Qt5::Widgets Qt5::Core)

target_link_libraries(${DriverStation}
Qt5:Core
Qt5:Widgets
    )

这是输出:

CMake Warning at CMakeLists.txt:10 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.
  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:
    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake
  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.
CMake Warning at CMakeLists.txt:11 (find_package):
  By not providing "FindQt5Declarative.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Declarative", but CMake did not find one.
  Could not find a package configuration file provided by "Qt5Declarative"
  with any of the following names:
    Qt5DeclarativeConfig.cmake
    qt5declarative-config.cmake
  Add the installation prefix of "Qt5Declarative" to CMAKE_PREFIX_PATH or set
  "Qt5Declarative_DIR" to a directory containing one of the above files.  If
  "Qt5Declarative" provides a separate development package or SDK, be sure it
  has been installed.
CMake Error at CMakeLists.txt:15 (target_link_libraries):
  Cannot specify link libraries for target "Qt5:Core" which is not built by
  this project.
-- Configuring incomplete, errors occurred!
See also "C:/Users/javie/AndroidStudioProjects/DriverStation/app/.externalNativeBuild/cmake/debug/x86_64/CMakeFiles/CMakeOutput.log".
-- Check for working C compiler: C:/Users/javie/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/javie/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Users/javie/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
-- Check for working CXX compiler: C:/Users/javie/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at CMakeLists.txt:10 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.
  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:
    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake
  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.
CMake Warning at CMakeLists.txt:11 (find_package):
  By not providing "FindQt5Declarative.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Declarative", but CMake did not find one.
  Could not find a package configuration file provided by "Qt5Declarative"
  with any of the following names:
    Qt5DeclarativeConfig.cmake
    qt5declarative-config.cmake
  Add the installation prefix of "Qt5Declarative" to CMAKE_PREFIX_PATH or set
  "Qt5Declarative_DIR" to a directory containing one of the above files.  If
  "Qt5Declarative" provides a separate development package or SDK, be sure it
  has been installed.
CMake Error at CMakeLists.txt:15 (target_link_libraries):
  Cannot specify link libraries for target "Qt5:Core" which is not built by
  this project.
-- Configuring incomplete, errors occurred!
See also "C:/Users/javie/AndroidStudioProjects/DriverStation/app/.externalNativeBuild/cmake/debug/mips/CMakeFiles/CMakeOutput.log".
-- Check for working C compiler: C:/Users/javie/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/javie/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Users/javie/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
-- Check for working CXX compiler: C:/Users/javie/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at CMakeLists.txt:10 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.
  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:
    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake
  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.
CMake Warning at CMakeLists.txt:11 (find_package):
  By not providing "FindQt5Declarative.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Declarative", but CMake did not find one.
  Could not find a package configuration file provided by "Qt5Declarative"
  with any of the following names:
    Qt5DeclarativeConfig.cmake
    qt5declarative-config.cmake
  Add the installation prefix of "Qt5Declarative" to CMAKE_PREFIX_PATH or set
  "Qt5Declarative_DIR" to a directory containing one of the above files.  If
  "Qt5Declarative" provides a separate development package or SDK, be sure it
  has been installed.
CMake Error at CMakeLists.txt:15 (target_link_libraries):
  Cannot specify link libraries for target "Qt5:Core" which is not built by
  this project.
-- Configuring incomplete, errors occurred!

0 个答案:

没有答案