Http://qt-project.org/doc/qtcreator-3.0/creator-project-cmake.html
Method 1: Use Qmake to edit the project file Xxxx.pro add
- equals (Qt_arch, "arm") {
- target. Path = / Tmp $${ target " / bin
- installs += target
- }
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:
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 ()
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.
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