-
Notifications
You must be signed in to change notification settings - Fork 78
Description
I have been using cmake_git_version_tracking for a while and with the fetch content approach never had any problems. Recently I tried to create a Conan package for a library and thought it would be great to be able to get version information about the library. Unfortunately I had no luck. After a very long session with Brave Browser AI which is usually helpful I ended up with this ahead of the fetch content section:
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/.git")
set(GIT_FAIL_IF_NONZERO_EXIT FALSE)
endif()
I'm not sure whether this was the correct approach - it cleared up some errors and took me further down the rabbit hole. The AI also suggested using scm tools from Conan to reference the local repo of the library package. I am also able to copy the .git directory itself into the package. Could I have cmake_git_version_tracking use that?
E.g.
in ~/Repo/Conan2Data/b/sha259617eafbeded3
○ → ls -a b
. .. CMakeLists.txt CMakeUserPresets.json conaninfo.txt .git include src test
So, should this be possible? In the the end the closest I could get to success was the linker failing when trying to create the executable for the test_package (if you don't know Conan it creates an example consumer for the package to make sure the package has built properly and the library can be linked.). The errors were generally of the type 'undefined reference to git_Describe()' et al.