Lists of files in a project file are typically split across multiple lines, one file per line, with each line terminated by a backslash to continue the list. e.g.
SOURCES += File1.cpp \ File2.cpp \ File3.cpp HEADERS += File1.h \ File2.h \ File3.h
If you add files using QtCreator, it maintains this, modifying the last line to add " \", then adding the new file on the next line.
This can cause problems in version control systems when two people add different files to the project. For example:
- In some VCSs, such as svn, it can cause merge conflicts because both people have to modify the trailing line.
- If the merge is done automatically, it is possible end up with invalid project file, such as:
SOURCES += File1.cpp \ File2.cpp \ File3.cpp HEADERS += File1.h \ File2.h \ File3.h \ File4.h File5.h
It's trivial to avoid all these problems, by always adding a trailing slash to the end of the last line when you add the line:
SOURCES += File1.cpp \ File2.cpp \ File3.cpp \ HEADERS += File1.h \ File2.h \ File3.h \
We try to do this, and it makes merging much more straightforward, but it relies on every developer remembering to manually fix-up their project files before committing, and when people forget it's a nuisance.
It would be helpful if QtCreator had an option to always add a trailing slash when adding files to a .pro file.
- relates to
QTCREATORBUG-553 Add the option to sort the list of SOURCES and HEADERS in qmake files
|For Gerrit Dashboard: QTCREATORBUG-21807|
|250853,3||QmakePM: Do a "sorted insert" when adding files||master||qt-creator/qt-creator||Status: MERGED||+2||0|