File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -816,9 +816,19 @@ else()
816816 set (V_GIT_DESCRIBE_OUTPUT "" )
817817 set (V_GIT_DESCRIBE_REGEXP "^v([0-9]+).([0-9]+).([0-9]+)(.*)\n $" )
818818
819+ # When libretroshare is built inside the RetroShare super-project (as a
820+ # submodule), the displayed "RetroShare Version" must reflect the root
821+ # repository, not this submodule. Describe the parent repo when present;
822+ # fall back to this directory for standalone / FetchContent / Android
823+ # builds where ../.git does not exist.
824+ set (V_GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR } " )
825+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR } /../.git" )
826+ set (V_GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR } /.." )
827+ endif ()
828+
819829 execute_process (
820830 COMMAND ${GIT_EXECUTABLE} describe --tags --long --match v*.*.*
821- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR } "
831+ WORKING_DIRECTORY "${V_GIT_DIR } "
822832 OUTPUT_VARIABLE V_GIT_DESCRIBE_OUTPUT
823833 RESULT_VARIABLE V_GIT_RESULT ) # Avoid CMake failure if git fails
824834
You can’t perform that action at this time.
0 commit comments