我正在尝试使用 CMAKE 编译一个 .cpp 程序。当我只是在终端上使用 gcc 时,我需要输入:
gcc nxt_bt_connect.c -o nxt_bt_connect -lm -lbluetooth
Run Code Online (Sandbox Code Playgroud)
如何将这两个链接器标志包含到我的 CmakeLists.txt(粘贴在下面)文件中?
# YARP needs CMake 2.6 or greater
cmake_minimum_required(VERSION 2.6)
# find YARP
find_package(YARP REQUIRED)
# add YARP include directories
include_directories(${YARP_INCLUDE_DIRS})
# set up our program
add_executable(send_angles send_angles.cpp)
# link with YARP libraries
target_link_libraries(send_angles ${YARP_LIBRARIES})
Run Code Online (Sandbox Code Playgroud)
谢谢!!
尝试:
set(EXTRA_LIBS ${YARP_LIBRARIES})
list(APPEND EXTRA_LIBS "m")
list(APPEND EXTRA_LIBS "bluetooth")
target_link_libraries(send_angles ${EXTRA_LIBS})
Run Code Online (Sandbox Code Playgroud)
或者:
target_link_libraries(send_angles "${YARP_LIBRARIES};m;bluetooth")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1825 次 |
| 最近记录: |