cmake_modules/revinfo.cmake
changeset 10045 2ca144d2a42f
parent 10025 ec966363adbe
child 15449 6e09555b25b4
equal deleted inserted replaced
10044:33e64afccd3b 10045:2ca144d2a42f
     1 #detect Mercurial revision and init rev/hash information
     1 #detect Mercurial revision and init rev/hash information
     2 find_program(HGCOMMAND hg)
     2 find_program(HGCOMMAND hg)
     3 find_program(GITCOMMAND git)
     3 find_program(GITCOMMAND git)
     4 if(EXISTS ${CMAKE_SOURCE_DIR}/.hg AND HGCOMMAND)
     4 if(EXISTS ${CMAKE_SOURCE_DIR}/.hg AND HGCOMMAND AND NOT NOVERSIONINFOUPDATE)
     5     execute_process(COMMAND ${HGCOMMAND} identify -in
     5     execute_process(COMMAND ${HGCOMMAND} identify -in
     6                     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
     6                     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
     7                     OUTPUT_VARIABLE internal_version
     7                     OUTPUT_VARIABLE internal_version
     8                     ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
     8                     ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
     9                     )
     9                     )
    19     #let's assume that if you have hg you might be interested in debugging
    19     #let's assume that if you have hg you might be interested in debugging
    20     set(default_build_type "DEBUG")
    20     set(default_build_type "DEBUG")
    21 
    21 
    22     #write down hash and rev for easy picking should hg be missing
    22     #write down hash and rev for easy picking should hg be missing
    23     file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n")
    23     file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n")
    24 elseif(EXISTS ${CMAKE_SOURCE_DIR}/.git AND GITCOMMAND)
    24 elseif(EXISTS ${CMAKE_SOURCE_DIR}/.git AND GITCOMMAND AND NOT NOVERSIONINFOUPDATE)
    25     execute_process(COMMAND ${GITCOMMAND} rev-parse --short HEAD
    25     execute_process(COMMAND ${GITCOMMAND} rev-parse --short HEAD
    26                     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    26                     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    27                     OUTPUT_VARIABLE HEDGEWARS_HASH
    27                     OUTPUT_VARIABLE HEDGEWARS_HASH
    28                     ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
    28                     ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
    29                     )
    29                     )