Import .props file into .vcxproj generated by qmake

Using command

qmake -tp vc -r 

I am creating a Visual Studio .sln file and a bunch of .vcxproj files from the corresponding Qt .pro file and a bunch of .pri files.

I would like those generated .vcxproj files to import my own .props file. The path to which I can provide qmake or embed it in those .pro / .pri .

Is it possible? If so, how?

Since in my research it seems that this can only be done by adding a user extension (which I should write first ...) on mkspecs ...

+4
source share
1 answer

Judging by the qmake source code, this is not possible. I reviewed qmake\generators\win32\msbuild_objectmodel.cpp both Qt4.8.5 and the latest version of Qt5 , and the only Property Sheets added by qmake, Microsoft.Cpp.*.props (of various kinds):

 xml << tag("Import") << attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props") << attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')") << closetag() << closetag(); 

I solved this problem by creating a quick Python script that does post processing in the generated * .vcxproj files:

 for l in fileinput.FileInput('Project.vcxproj', inplace=1): print l, if 'PropertySheets' in l: print ' <Import Project="YourPropertySheets.props" />' 

Of course, it would be better to fix qmake with the new features, but since there are only three people, including you and me, who are concerned about this, I believe that hacking is the best solution.

+1
source

All Articles