There was such a problem: using cmake to install the compiled executable in a certain directory, along with all the dependent libraries (qt), so that later this folder could be simply transferred to another computer, with the same architecture (and installed packages, like built-essential). And do it on two systems: linux & windows. And then there are two problems:

1) What are the dependencies of Qt libraries and how to detect them with cmake (if possible)

2) when used

install(FILES $<TARGET_FILE:Qt5::packet> DESTINATION bin) 

on Linux, the following libraries will be copied: libQt5packet.so.5.11.1 and when you try to start, the program will immediately declare that it cannot find the corresponding libraries. And the team

 export LD_LIBRARY_PATH=/install path/bin 

No result gives.

UPD The second problem was solved: the problem was that the program tries to link to an alias (pointer to the library), which has the form libQt5some_package.so.5 , so it must also be copied, for which there is a corresponding generator expression in cmake :

 install(FILES $<TARGET_SONAME_FILE:Qt5::Widgets>) 

Thus under Linux everything (on a separate machine has not yet verified) seems to work, but the first question is still open.

  • And what do export LD_LIBRARY_PATH=/../bin you think? - arrowd
  • @arrowd in my opinion, it adds the way in which applications search for libraries, but I'm not sure. - Andrej Levkovitch
  • Yes, and this path is /bin . It is unlikely that your libraries are there. - arrowd
  • @arrowd you did not understand, to blame, unclearly put it: I meant that this is the path to that bin folder to which everything was installed - Andrej Levkovitch
  • Or maybe we should use windeployqt and the corresponding utility for Linux? - vadrozh

0