0

I have an issue something related to this but more with CMake commands.

I am using find package in my project to get info about working copy revision which i need to display in my application.

# Load built-in SVN module
find_package(Subversion)

if(SUBVERSION_FOUND)
    # WC_INFO will define ${PROJECT_NAME}_WC_REVISION among others
    subversion_wc_info(${PROJECT_SOURCE_DIR} ${PROJECT_NAME})

    set(${PROJECT_NAME}_VERSION_REVISION ${${PROJECT_NAME}_WC_REVISION})
endif()

Issue:

I created a branch from an older revision (#300) to fix some bug and switched the new branch to current working copy. But when i run find_package(Subversion) command on the newly created branch it gives me the same WC copy revision #363. I was expecting to get #355 i.e. ${${PROJECT_NAME}_WC_REVISION} working copy revision for the new branch should be #355. But i am getting #363 for both the branches.

      Main
        |
   #300 |---branch
        |   |
        |   | 
        |   HEAD (committed changes at #355)
        |
        |
       HEAD
       #363

Am i missing something here? I thought ${${PROJECT_NAME}_WC_REVISION} should give me HEAD revision of currently requested branch. How do i get the svn HEAD info for respective branches?

MarKS
  • 494
  • 6
  • 22
  • 1
    Sounds like a caching problem. Did you already deleted the CMakeCache.txt file and repeated the CMake run? – vre Feb 19 '20 at 14:47
  • "But when i run `find_package(Subversion)` command on the newly created branch..." - you probably mean command `subversion_wc_info` which is intended to examine your project. The command `find_package(Subversion)` just locates `svn` executable, not a your project. – Tsyvarev Feb 19 '20 at 15:29
  • i feel stupid now. @vre it was the cache problem. It worked. thanks! I would mark your suggestion as an answer if you are willing to add it. Or else i will just answer my own question just to resolve this question. – MarKS Feb 19 '20 at 16:25

1 Answers1

0

When switching branches in the Subversion repository you need to remove the CMakeCache.txt and rerun CMake.

vre
  • 6,041
  • 1
  • 25
  • 39