[Qt-creator] Remote Linux plugin and CMake

Oleksii Serdiuk contacts at oleksii.name
Thu Aug 22 16:16:29 CEST 2013


On 21/08/13 15:21, Stephen Kelly wrote:
> Christian Kandeler wrote:
>>> - The project has to generate a file which tells Creator what to deploy.
>>> Oleksii Serdiuk has implemented that, and it works like this. The project
>>> has to have a CMakeDeployment.txt in the root of the project, which
>>> essentially contains a list of files that should be deployed and where to
>>> deploy them The benefit here is, that Oleksii already wrote a patch, and
>>> that we could use the same file format also for the generic and autotools
>>> projects.
>>
>> This approach does not have the above-mentioned problem.
> 
> It does have the problem of redundant maintanence of that file (manually).

CMake if powerful enough to automate generation of this file. That's
what we do in our project.

We have two macros defined:
> macro(add_deployment_file SRC DEST)
>     file(RELATIVE_PATH path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
>     file(APPEND "${CMAKE_SOURCE_DIR}/CMakeDeployment.txt" "${path}/${SRC}:${DEST}\n")
> endmacro()
> 
> macro(add_deployment_folder 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()

And in the project we do, first:
> file(WRITE "${CMAKE_SOURCE_DIR}/CMakeDeployment.txt" "${DEPLOYMENT_PREFIX}\n")

and then, for example:
> add_deployment_file("qmldir" "import/myplugin")
> add_deployment_folder("resources" "import/myplugin")

Now, to update CMakeDeployment.txt you only need to re-run cmake.

Binaries (libs and executables) are put into deployment list
automatically by CMake plugin by traversing its build targets.

-- 
With best regards,
Olekii Serdiuk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4813 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20130822/40205570/attachment.bin>


More information about the Qt-creator mailing list