为cmake执行外部本机构建

时间:2018-06-07 05:27:43

标签: android c++ cmake

cMakeLists.txt内容:

cmake_minimum_required(VERSION 3.4.1)

SET(CMAKE_CXX_FLAGS "-Wno-error=format-security -Wno-error=pointer-sign")


set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI})


add_library( # Sets the name of the library.
         native-camera2-lib

         # Sets the library as a shared library.
         SHARED

         # Provides a relative path to your source file(s).
         src/main/jni/native-camera2-lib.cpp )
include_directories(src/main/jni/)

find_library( # Sets the name of the path variable.
          log-lib

          # Specifies the name of the NDK library that
          # you want CMake to locate.
          log )

target_link_libraries( # Specifies the target library.
                   native-camera2-lib

                   # Links the target library to the log library
                   # included in the NDK.
                   ${log-lib} )

在Android工作室运行app之后。

  

失败:构建因异常而失败。   13:19:19.936 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter] *出了什么问题:   13:19:19.936 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter]配置项目':app'时出现问题。   13:19:19.936 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter]>为cmake执行外部本机构建D:\ AndroidStudioProjects \ camerandk \ app \ src \ main \ jni \ CMakeLists.txt   13:19:19.936 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter]

0 个答案:

没有答案
相关问题