cmake ninja: error: 'xxx', needed by 'xxx', missing and no known rule to make it

出现上述错误,是因为指定依赖的第三方so的路径设置错误导致的,大多是因为设置的不是绝对路径导致的
我的CMakeLists.txt放在当前module的根目录下

set_target_properties(
        thirdSo
        PROPERTIES 
        IMPORTED_LOCATION 

//设置相对路径 编译不通过
src/main/jniLibs/${CMAKE_ANDROID_ARCH_ABI}/libThirdSo.so)
set_target_properties(
        thirdSo
        PROPERTIES 
        IMPORTED_LOCATION 
//设置绝对路径 下面写法是正确的 编译通过
${PROJECT_SOURCE_DIR}/src/main/jniLibs/${CMAKE_ANDROID_ARCH_ABI}/libThirdSo.so)

当然你也可以配合其他Cmake常用变量使用,不一定是${PROJECT_SOURCE_DIR}

你可能感兴趣的:(cmake ninja: error: 'xxx', needed by 'xxx', missing and no known rule to make it)