Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a vcproj with qmake such that its filters reflect the directory structure?

I use qmake (Qt 4.5.1) to create my vcproj files. I would like to create customized filters for the output vcproj, such that not every *.h file ends up in the "Header Files" filter, *.cpp in "Source Files" etc.

For example, a project containing the files

foo\foo.h
foo\foo.cpp
bar\bar.h
bar\bar.cpp

should have a vcproj file with

foo
   foo.h
   foo.cpp
bar
   bar.h
   bar.cpp

instead of

Header Files
   bar.h
   bar.cpp
Source Files
   bar.cpp
   foo.cpp

Thanks!

like image 879
balint.miklos Avatar asked Oct 14 '22 15:10

balint.miklos


1 Answers

If you run qmake with CONFIG -= flat, you'll get the following project structure:

Header Files
    foo
        foo.h
    bar
        bar.h
Source Files
    foo
        foo.cpp
    bar
        bar.cpp

This has always bothered me, which is why I'm writing a fix on the Mac for Xcode projects. Eventually I'll probably write one for VS (which is easier since the project file is an XML document).

If you're writing software strictly on Windows using Visual Studio, I would recommend using the Visual Studio Integration Plugin as it will automatically generate the UIC and MOC steps needed to compile Qt files.

like image 133
Krsna Avatar answered Nov 15 '22 09:11

Krsna