Fix svn revision detection that I broke when adding git-svn support.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3958 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-03-29 16:17:55 +00:00
parent c5a9e6626e
commit ca79a4efc0

View File

@ -18,12 +18,11 @@ if (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
message (STATUS "${__svn_change}") message (STATUS "${__svn_change}")
endforeach (__svn_change ${__svn_changes}) endforeach (__svn_change ${__svn_changes})
endif (__svn_changes) endif (__svn_changes)
message (STATUS "${SOURCE_DIR} contains a .svn and is revision ${MY_WC_REVISION}")
# write a file with the SVNVERSION define # write a file with the SVNVERSION define
file (WRITE svnversion.h.txt "#define SVNVERSION r${MY_WC_REVISION}\n") file (WRITE "${OUTPUT_DIR}/svnversion.h.txt" "#define SVNVERSION r${MY_WC_REVISION}\n")
else (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn") else (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
file (WRITE svnversion.h.txt "#define SVNVERSION local\n") # try git-svn
endif ()
if (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.git") if (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.git")
# the FindSubversion.cmake module is part of the standard distribution # the FindSubversion.cmake module is part of the standard distribution
include (${SOURCE_DIR}/CMake/Modules/FindGitSubversion.cmake) include (${SOURCE_DIR}/CMake/Modules/FindGitSubversion.cmake)
@ -42,11 +41,12 @@ if (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.git")
set (MY_WC_REVISION "${MY_WC_REVISION}-dirty") set (MY_WC_REVISION "${MY_WC_REVISION}-dirty")
endif () endif ()
# write a file with the SVNVERSION define # write a file with the SVNVERSION define
file (WRITE svnversion.h.txt "#define SVNVERSION r${MY_WC_REVISION}\n") file (WRITE "${OUTPUT_DIR}/svnversion.h.txt" "#define SVNVERSION r${MY_WC_REVISION}\n")
else (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn") else (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
file (WRITE svnversion.h.txt "#define SVNVERSION local\n") file (WRITE "${OUTPUT_DIR}/svnversion.h.txt" "#define SVNVERSION local\n")
endif () endif (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.git")
endif (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
# copy the file to the final header only if the version changes # copy the file to the final header only if the version changes
# reduces needless rebuilds # reduces needless rebuilds
execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different svnversion.h.txt svnversion.h) execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OUTPUT_DIR}/svnversion.h.txt" "${OUTPUT_DIR}/svnversion.h")