ned14 / quickcpplib

Eliminate all the tedious hassle when making state-of-the-art C++ 14 - 23 libraries!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Persuade upstream dependencies to use .gitattributes so quickcpplib doesn't have to write its own

barcharcraz opened this issue · comments

This breaks some buildsystems and package management tools that want to set the source directory to read-only, it's also super annoying because it means generated files get checked into git.

I recommend writing revision.cpp to somewhere under ${PROJECT_BINARY_DIR} and replacing the header scans you do with: file(GLOB_RECURSE ... CONFIGURE_DEPENDS) which allows cmake to maintain it's own cache for you.

The header scans shouldn't fire if the header scan cache is up to date. Unless there is any source directory modification apart from revision.hpp, this behaviour is intentional.

I do see writes to the source directory in my superbuild for the following two files:

git-submodule-path-to/quickcpplib/include/quickcpplib/optional//.gitattributes
git-submodule-path-to/quickcpplib/pcpp/pcpp/ply/.gitattributes

I assume this is due to quickcpplib trying to fetch some dependencies of it's own? Shouldn't those be pulled into the build directory instead? Is there a way to avoid those writes?

Those are a hack to work around git reporting the source directory as dirty, which causes some package managers to refuse to package the library at all. This occurs when, for example, when the git repo had a LF checkin, but it is then checked out on Windows. The .gitattributes file ensure that the correct CRLF translation is used to keep git saying the source directory is clean.

You make a good point though: the authors of those libraries ought to add .gitattributes, then quickcpplib wouldn't have to poke its own into them. I've renamed and reopened this issue to track that.

The Optional subrepo now specifies .gitattributes, so we no longer normally write into the source repo. Thanks for raising this issue!