- Improved svnversion writes.
This commit is contained in:
parent
e508befbf5
commit
e595169501
@ -14,20 +14,45 @@ set_source_files_properties(version.h
|
|||||||
GENERATED true)
|
GENERATED true)
|
||||||
find_program (SVNVERSION_EXECUTABLE NAMES svnversion)
|
find_program (SVNVERSION_EXECUTABLE NAMES svnversion)
|
||||||
mark_as_advanced (SVNVERSION_EXECUTABLE)
|
mark_as_advanced (SVNVERSION_EXECUTABLE)
|
||||||
|
mark_as_advanced (SVNVERSION_DYNAMIC)
|
||||||
|
set (SVNVERSION_DYNAMIC false)
|
||||||
if (SVNVERSION_EXECUTABLE)
|
if (SVNVERSION_EXECUTABLE)
|
||||||
# svnversion found; we should always build this
|
# svnversion found
|
||||||
mark_as_advanced (SVN_Version)
|
if (UNIX)
|
||||||
message (STATUS "Generating version.h using svnversion command")
|
# Unix system
|
||||||
|
# test whether svnversion gives useful info
|
||||||
exec_program (${SVNVERSION_EXECUTABLE}
|
exec_program (${SVNVERSION_EXECUTABLE}
|
||||||
OUTPUT_VARIABLE SVN_Version
|
OUTPUT_VALUE SVN_Result
|
||||||
)
|
)
|
||||||
message (STATUS "svnversion gave ${SVN_Version}")
|
mark_as_advanced (SVN_Result)
|
||||||
file (WRITE version.h
|
if (SVN_Result STREQUAL "exported")
|
||||||
"#define SVNVERSION \"${SVN_Version}\"\n"
|
# svnversion gives useful stuff
|
||||||
)
|
set (SVNVERSION_DYNAMIC true)
|
||||||
else (SVNVERSION_EXECUTABLE)
|
endif (SVN_Result STREQUAL "exported")
|
||||||
# No svnversion. what do we write then? just empty...?
|
mark_as_advanced (SVNDIR)
|
||||||
message (STATUS "Generating empty version.h")
|
endif (UNIX)
|
||||||
file (WRITE version.h "")
|
|
||||||
endif (SVNVERSION_EXECUTABLE)
|
endif (SVNVERSION_EXECUTABLE)
|
||||||
|
|
||||||
|
if (SVNVERSION_DYNAMIC)
|
||||||
|
# add a command to generate version.h
|
||||||
|
message (STATUS "Generating version.h dynamically using svnversion command")
|
||||||
|
add_custom_command (
|
||||||
|
OUTPUT version.h
|
||||||
|
# The version number depends on all the files; if they
|
||||||
|
# don't change, neither should the version number
|
||||||
|
# (although this might be incorrect when updating the
|
||||||
|
# current directory)
|
||||||
|
DEPENDS ${Scyther_sources}
|
||||||
|
DEPENDS .svn
|
||||||
|
COMMAND echo
|
||||||
|
ARGS "\\#define SVNVERSION \\\"`${SVNVERSION_EXECUTABLE}`\\\"" >version.h
|
||||||
|
COMMENT "Generating subversion version information in version.h using svnversion command"
|
||||||
|
)
|
||||||
|
else (SVNVERSION_DYNAMIC)
|
||||||
|
# Don't dynamically generate, simply empty every time
|
||||||
|
file (WRITE version.h "#define SVNVERSION \"Unknown\"\n")
|
||||||
|
endif (SVNVERSION_DYNAMIC)
|
||||||
|
|
||||||
|
# add the version number to the sources
|
||||||
|
set (Scyther_sources ${Scyther_sources} version.h)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user