Hi,
After working on a project in windows using Qt/MinGW I decided to port it to linux. I found that the best way to get it working on linux (using Ubuntu) is to use Qt's qmake utility to generate the makefile. It can be used on windows and linux without modification.
That being said, I found it quite difficult to find some info on how to configure C::B so that it could be used together with qmake. After I wile I got it working and stumbled on some things you really need to know. Here's the recipe I've been using:
1. Create a regulare Qt-project.
2. Add a text-file, give it the name of youre project and end it with .pro (e.g. "myproject.pro"). This will be youre qmake project file.
3. Now open the project properties. At the tab "Project settings", check the option "This is a custom makefile".
4. Now select the build options of the project.
5. Add a pre-build step
for all targets and add the following command:
$(#qt4)/bin/qmake -o makefile $PROJECT_NAME.pro
Note that this requires a environment variable #qt4 pointing to the base location of the Qt framework.
Now thats the easy part. Now for the nagging details. The qmake tool generates a makefile having two
targets by default named "debug" and "release". Now you might not see this, but C::B also has two default targets "Debug" and "Release". They look the same, only the case is different. And thats a problem since makefiles happen to be case-sensitive. To solve it, you have to change the commands C::B uses to invoke the custom makefile.
6. Go to the
"Debug" build configuration and select the tab "Make commands". Replace the $target by plain "debug". Watch the case!
7. For the step "Clean project/target" modify the value clean$target and replace it by "debug-clean". This is because the qmake default makefile will specify a target "debug-clean" to clean the debug build.
8. Repeat 6 and 7 for the "Release" build configuration replacing $target by "release".
That's it.
Note that you can also rename the virtual targets "Debug"-->"debug" and "Release"-->"release". If you choose this approach, you can skip step 6 and you can specify the alternate make commands for all targets. For step 7 you need to replace clean$target by $target-clean.
Good luck and happy coding,
Ruud