Developing embedded Linux programs using Qtcreator

Source: Internet
Author: User

Http://qt-project.org/doc/qtcreator-3.0/creator-project-cmake.html


Method 1: Use Qmake to edit the project file Xxxx.pro add


    1. equals (Qt_arch, "arm")  {
    2.    target. Path = / Tmp $${ target " / bin
    3.    installs += target
    4. }



CONFIG (Debug, Debug|release) {

Message (this is debug version)

} else {

Defines + = Qt_no_debug_output

Message (Disable debug, this is release version)

}


Method 2: Use CMakeList.txt

Deploying CMake Projects to Embedded Linux Devices

Qt Creator cannot extract files to being installed from a CMake project, and therefore, only executable targets is automatic Ally added to deployment files. You must specify all other files in the QtCreatorDeployment.txt file, the Create and place in the root direct Ory of the CMake project.

Use the following syntax in the file:

<deployment/prefix>

<Relative/Source/File1>:<Relative/Destination/Dir1>...

< relative/ Source Filen> : < Relative/ Destination/ Dirn>

where:

    • < Relative/source/file> is the file path relative to the CMake project root. No directories or wildcards is allowed in this value.

    • < Relative/destination/dir> is the destination directory, path relative to

To automate the creation of QtCreatorDeployment.txt file:

  1. Define the following macros in the top level CMakeLists.txt file:

    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_de Ployment_file ("${filename}""${dest}/${path}") Endforeach (filename) endmacro ()


  2. Use add_deployment_file (<file/name>) to add files and add_deployment_directory (<folder/name >) to add directories (including subdirectories) to the QtCreatorDeployment.txt file.

  3. Re-run CMake after you add or remove files using the macros.


This article is from the "Guns and Roses blog," Please be sure to keep this source http://axlrose.blog.51cto.com/434566/1413358

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.