cmake_modules/revinfo.cmake
changeset 9151 1d2df388fcc6
parent 9150 79c58ff0d4b1
child 9905 ec0d9f737449
equal deleted inserted replaced
9150:79c58ff0d4b1 9151:1d2df388fcc6
    10     string(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version})
    10     string(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version})
    11     string(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" HEDGEWARS_REVISION ${internal_version})
    11     string(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" HEDGEWARS_REVISION ${internal_version})
    12     string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" HEDGEWARS_HASH ${internal_version})
    12     string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" HEDGEWARS_HASH ${internal_version})
    13 
    13 
    14     if(HGCHANGED)
    14     if(HGCHANGED)
    15         message(${WARNING} "You have uncommitted changes in your repository!")
    15         message("*** You have uncommitted changes in your repository ***")
    16     endif()
    16     endif()
    17     #let's assume that if you have hg you might be interested in debugging
    17     #let's assume that if you have hg you might be interested in debugging
    18     set(default_build_type "DEBUG")
    18     set(default_build_type "DEBUG")
    19     #write down hash and rev for easy picking should hg be missing
    19     #write down hash and rev for easy picking should hg be missing
    20     file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n")
    20     file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n")
    26         file(STRINGS ${version_info} internal_version REGEX "rev")
    26         file(STRINGS ${version_info} internal_version REGEX "rev")
    27         string(REGEX REPLACE "rev ([0-9]*)" "\\1" HEDGEWARS_REVISION ${internal_version})
    27         string(REGEX REPLACE "rev ([0-9]*)" "\\1" HEDGEWARS_REVISION ${internal_version})
    28         file(STRINGS ${version_info} internal_version REGEX "hash")
    28         file(STRINGS ${version_info} internal_version REGEX "hash")
    29         string(REGEX REPLACE "hash ([a-zA-Z0-9]*)" "\\1" HEDGEWARS_HASH ${internal_version})
    29         string(REGEX REPLACE "hash ([a-zA-Z0-9]*)" "\\1" HEDGEWARS_HASH ${internal_version})
    30     else()
    30     else()
    31         message(${WARNING} "${CMAKE_SOURCE_DIR}/share/version_info.txt not found, revision information "
    31         message(WARNING "${CMAKE_SOURCE_DIR}/share/version_info.txt not found, revision information "
    32                            "will be incorrect!!! Contact your source provider to fix this!")
    32                         "will be incorrect!!! Contact your source provider to fix this!")
    33         set(HEDGEWARS_REVISION "0000")
    33         set(HEDGEWARS_REVISION "0000")
    34         set(HEDGEWARS_HASH "unknown")
    34         set(HEDGEWARS_HASH "unknown")
    35     endif()
    35     endif()
    36 endif()
    36 endif()
    37 
    37