cmake_modules/revinfo.cmake
changeset 15454 6e09555b25b4
parent 10025 ec966363adbe
equal deleted inserted replaced
15453:6e4ca1c46370 15454:6e09555b25b4
    15     if(HGCHANGED)
    15     if(HGCHANGED)
    16         message("*** You have uncommitted changes in your repository ***")
    16         message("*** You have uncommitted changes in your repository ***")
    17     endif()
    17     endif()
    18 
    18 
    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 AND NOT NOVERSIONINFOUPDATE)
    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
    28                     ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
    28                     ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
    29                     )
    29                     )
    30     set(HEDGEWARS_REVISION "GIT")
    30     set(HEDGEWARS_REVISION "GIT")
    31 
    31 
    32     #let's assume that if you have git you might be interested in debugging
    32     #let's assume that if you have git you might be interested in debugging
    33     set(default_build_type "DEBUG")
    33     set(default_build_type "Debug")
    34 
    34 
    35     #write down hash and rev for easy picking should hg be missing
    35     #write down hash and rev for easy picking should hg be missing
    36     file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n")
    36     file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n")
    37 else()
    37 else()
    38     set(default_build_type "RELEASE")
    38     set(default_build_type "Release")
    39     # when compiling outside rev control, fetch revision and hash information from version_info.txt
    39     # when compiling outside rev control, fetch revision and hash information from version_info.txt
    40     find_file(version_info version_info.txt PATH ${CMAKE_SOURCE_DIR}/share)
    40     find_file(version_info version_info.txt PATH ${CMAKE_SOURCE_DIR}/share)
    41     if(version_info)
    41     if(version_info)
    42         file(STRINGS ${version_info} internal_version REGEX "rev")
    42         file(STRINGS ${version_info} internal_version REGEX "rev")
    43         string(REGEX REPLACE "rev ([GIT0-9]*)" "\\1" HEDGEWARS_REVISION ${internal_version})
    43         string(REGEX REPLACE "rev ([GIT0-9]*)" "\\1" HEDGEWARS_REVISION ${internal_version})