CMake无法确定目标的链接器语言

时间:2019-07-17 06:14:50

标签: cmake

从其他一些代码生成“ libcommon.a”静态库。 尝试在CPP的另一个项目代码中访问此静态库。 静态库“ libcommon.a”应使用“ CMakeList.txt”文件进行访问。

在CMakelist.txt中添加了以下代码,以访问静态库libcommon.a

add_library(libnxcommon.a 
            STATIC 
            /home/oncall/RadioApp/lib/libnxcommon/cpp/src)

find_library(log-lib 
             log)

target_link_libraries(libnxcommon.a 
                      LINK_PUBLIC  
                      ${log-lib})

将libcommon.a保留在项目文件夹和输出文件夹中。

遇到错误-

Build command failed.
Error while executing process /home/oncall/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/oncall/RadioApp/POC/Native/app/.externalNativeBuild/cmake/debug/x86_64 --target native-lib}
[1/1] Re-running CMake...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/oncall/RadioApp/POC/Native/app/.externalNativeBuild/cmake/debug/x86_64
FAILED: /home/oncall/Android/Sdk/cmake/3.6.4111459/bin/cmake -H/home/oncall/RadioApp/POC/Native/app/src/main/cpp -B/home/oncall/RadioApp/POC/Native/app/.externalNativeBuild/cmake/debug/x86_64
CMake Error: CMake can not determine linker language for target: libcommon.a
ninja: error: rebuilding 'build.ninja': subcommand failed

0 个答案:

没有答案