我想将我的qt应用程序部署到远程Linux设备。我使用 qtcreator , cmake 和 ninja 构建系统。但是,当我想通过ssh远程调试应用程序时,出现以下错误:
ninja: error: unknown target 'install'
15:56:22: The process "/usr/bin/cmake" exited with code 1.
答案 0 :(得分:1)
阅读Deploying CMake Projects to Embedded Linux Devices。取决于您可以
在您的CMakeLists.txt
中添加以下几行:
file(WRITE "${CMAKE_SOURCE_DIR}/QtCreatorDeployment.txt" "<deployment/prefix>\n")
macro(add_deployment_file SRC DEST)
file(RELATIVE_PATH path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
file(APPEND "${CMAKE_SOURCE_DIR}/QtCreatorDeployment.txt" "${path}/${SRC}:${DEST}\n")
endmacro()
macro(add_deployment_directory SRC DEST)
file(GLOB_RECURSE files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}/*")
foreach(filename ${files})
get_filename_component(path ${filename} PATH)
add_deployment_file("${filename}" "${DEST}/${path}")
endforeach(filename)
endmacro()
add_deployment_file(${CMAKE_BINARY_DIR}/${PROJECT_NAME} /path/to/remote/app)
从QtCreator
转到Projects/Run
,只需删除Deployment中的Install into temporary host directory
步骤。