target_link_libraries(rknn_shilinsanitation ${RKNN_RT_LIB} ${RGA_LIB} ${OpenCV_LIBS} PRIVATE OpenSSL::SSL OpenSSL::Crypto) CMake Error at CMakeLists.txt:89 (target_link_libraries): The INTERFACE, PUBLIC or PRIVATE option must appear as the second argument, just after the target name. CMake Error at CMakeLists.txt:97 (target_link_libraries): The INTERFACE, PUBLIC or PRIVATE option must appear as the second argument, just after the target name.
时间: 2024-03-26 21:38:12 浏览: 131
这个错误提示你在两个 `target_link_libraries` 命令中都没有正确指定链接选项的位置。
在 CMake 中,`target_link_libraries` 命令的语法如下:
```cmake
target_link_libraries(target-name [PRIVATE|PUBLIC|INTERFACE] library-name1 [library-name2 ...])
```
其中,`target-name` 表示要链接的目标名称,`library-name1`、`library-name2` 等表示要链接的库名称。选项 `PRIVATE`、`PUBLIC` 和 `INTERFACE` 用于指定链接选项的作用范围,必须紧跟在 `target-name` 后面。
为了解决这个问题,你需要将 `PRIVATE`、`PUBLIC` 或 `INTERFACE` 选项放在目标名称之后,例如:
```cmake
target_link_libraries(your-target-name PRIVATE library-name1 library-name2 ...)
```
对于你的情况,你需要将 `PRIVATE OpenSSL::SSL OpenSSL::Crypto` 选项放在目标名称 `${RKNN_RT_LIB} ${RGA_LIB} ${OpenCV_LIBS}` 后面,即:
```cmake
target_link_libraries(rknn_shilinsanitation ${RKNN_RT_LIB} ${RGA_LIB} ${OpenCV_LIBS} PRIVATE OpenSSL::SSL OpenSSL::Crypto)
```
这样就可以正确指定链接选项的位置,避免出现上述错误。
阅读全文