PDA

View Full Version : Using qmake to build ordinary C++ projects on differente computers



lgb3
19th October 2011, 18:35
Hi,

I've decided to use Qt Creator as a C++ IDE even for non-Qt projects. I'm coding it in the desktop pc, but I need to build the files on several different netbooks. I don't really know the reason, but the generated output executable file (using linux) in the desktop doesn't work on the netbooks. So I would like to just qmake/ make, in these netbooks to build the projects on them, without having to do it by hand using gcc, or creating myself a makefile, since qmake is pretty easy to code. Is it possible to do that?

Thanks in advance,
Luiz.

fullmetalcoder
19th October 2011, 20:52
Moving executables around between different Linux distributions is notoriously difficult. If you want to make sure a binary built on your desktop will work on the netbooks you have to either ensure that all the libraries you use are present on the netbooks in a version compatible to that you link against on your desktop. As this is unlikely to be the case, you should either copy ship these libraries along the executable or use static linking.

Assuming you already have the required compiler and libraries on the netbooks but cannot afford the overhead of installing the whole Qt SDK just to use qmake there are two options :

switch to another build system (e.g. CMake (http://www.cmake.org)) which can be installed standalone, contrary to qmake
copy the qmake binary (same remark about libs but I think qmake doesn't have too many dependencies) and the content of /usr/share/qt/mkspecs (or wherever the mkspecs are stored on your desktop) to the netbooks

lgb3
20th October 2011, 21:57
Moving executables around between different Linux distributions is notoriously difficult. If you want to make sure a binary built on your desktop will work on the netbooks you have to either ensure that all the libraries you use are present on the netbooks in a version compatible to that you link against on your desktop. As this is unlikely to be the case, you should either copy ship these libraries along the executable or use static linking.

Assuming you already have the required compiler and libraries on the netbooks but cannot afford the overhead of installing the whole Qt SDK just to use qmake there are two options :

switch to another build system (e.g. CMake (http://www.cmake.org)) which can be installed standalone, contrary to qmake
copy the qmake binary (same remark about libs but I think qmake doesn't have too many dependencies) and the content of /usr/share/qt/mkspecs (or wherever the mkspecs are stored on your desktop) to the netbooks


Thank you very much for your answer.
I moved to cmake. But, can Qt generate a CMakeLists instead of a qmake .pro ? This way I wouldn't even have to bother to write the CMakeLists myself.

ChrisW67
21st October 2011, 00:05
No. You have to write and maintain the CMakeLists.txt file. Detecting if a CMakeLists.txt file changes and offering to rerun CMake for you is about the limit of the support.