Mohsen Zahraee
Mohsen Zahraee

Reputation: 3483

How to deploy app remotely via ninja build system using qtcreator

I want to deploy my qt app to a remote Linux device. I use qtcreator, cmake, and the ninja build system. But when I want to debug my app remotely via ssh, I got following error:

ninja: error: unknown target 'install'
15:56:22: The process "/usr/bin/cmake" exited with code 1.

Upvotes: 0

Views: 939

Answers (1)

Mohsen Zahraee
Mohsen Zahraee

Reputation: 3483

Read Deploying CMake Projects to Embedded Linux Devices. Depending on that you can just

  1. Add following lines to your 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)
    
  2. From QtCreator go to Projects/Run and just delete Install into temporary host directory step in Deployment.

Upvotes: 1

Related Questions