I use code like the following to append a version to my applications
based on the current svn rev.

FIND_PACKAGE(Subversion)
IF(Subversion_FOUND)
        Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
        MESSAGE("Current revision is ${Project_WC_REVISION}")
        Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
        MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
        set (${PROJECT_NAME}_VERSION_PATCH
${${PROJECT_NAME}_VERSION_PATCH}.${Project_WC_REVISION})
ENDIF(Subversion_FOUND)


The problem is if the server is down it prevented me from working
since the failure to get a version ends up blocking the generate so I
added an option to disable the appending if I disable the option:

FIND_PACKAGE(Subversion)
IF(Subversion_FOUND)
        OPTION(APPEND_SVN_REV "Append subversion rev to application version" ON)
        
        IF(APPEND_SVN_REV)
                Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
                MESSAGE("Current revision is ${Project_WC_REVISION}")
                Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
                MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
        
                set (${PROJECT_NAME}_VERSION_PATCH
${${PROJECT_NAME}_VERSION_PATCH}.${Project_WC_REVISION})
        ENDIF(APPEND_SVN_REV)
        
ENDIF(Subversion_FOUND)


Is there an easy way it can just cache result of these checks and if
the server is down just use the cache instead of being fatal so I do
not have to use the switch to turn off this when the server is down?

-- 
John M. Drescher
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to