cgreen: CMake cannot generate gitrevision.h when cgreen is git submodule
It seams CMake cannot generate gitrevision.h when cgreen is included as git submodule.
Steps to reproduce
- Create empty repo
mkdir poc && cd poc && git init - Add cgreen as submodule
git submodule add https://github.com/cgreen-devs/cgreen.git - Configure it
cd cgreen && cmake . - Build
make
Actual Result
The make tool reports that there are no .git/logs/HEAD
make[2]: *** No rule to make target '.git/logs/HEAD', needed by 'gitrevision.h'. Stop.
make[1]: *** [CMakeFiles/Makefile2:1122: src/CMakeFiles/cgreen_shared.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
Expected result
Cgreen is built.
Additional info
Looks like when cgreen is included as a submodule, it doesn’t contain real .git directory. Instead, it contains .git file that points to real cgreen’s .git directory.
I know, it is not documented way to use cgreen, but it is really convenient in a CI environment.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (11 by maintainers)
Aah, yes, I didn’t spot that, and so yes, it would be better to have it at repo root.