CMakeLists.txt
changeset 8650 18807b6302c8
parent 8646 e31044b7fbba
child 8659 e49056d3aba1
equal deleted inserted replaced
8649:e3a9339ce1fd 8650:18807b6302c8
    47                     OUTPUT_VARIABLE internal_version
    47                     OUTPUT_VARIABLE internal_version
    48                     ERROR_QUIET
    48                     ERROR_QUIET
    49                 )
    49                 )
    50     #check local repo status
    50     #check local repo status
    51     string(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version})
    51     string(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version})
    52     string(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" revision_number ${internal_version})
    52     string(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" HEDGEWARS_REVISION ${internal_version})
    53     string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" hash_number ${internal_version})
    53     string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" HEDGEWARS_HASH ${internal_version})
    54 
    54 
    55     if(HGCHANGED)
    55     if(HGCHANGED)
    56         message(${WARNING} "You have uncommitted changes in your repository!")
    56         message(${WARNING} "You have uncommitted changes in your repository!")
    57     endif()
    57     endif()
    58     #let's assume that if you have hg you might be interested in debugging
    58     #let's assume that if you have hg you might be interested in debugging
    59     set(default_build_type "DEBUG")
    59     set(default_build_type "DEBUG")
    60     #write down hash and rev for easy picking should hg be missing
    60     #write down hash and rev for easy picking should hg be missing
    61     file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${revision_number}\nhash ${hash_number}\n")
    61     file(WRITE "${CMAKE_SOURCE_DIR}/share/version_info.txt" "Hedgewars versioning information, do not modify\nrev ${HEDGEWARS_REVISION}\nhash ${HEDGEWARS_HASH}\n")
    62 else()
    62 else()
    63     set(default_build_type "RELEASE")
    63     set(default_build_type "RELEASE")
    64     # when compiling outside rev control, fetch revision and hash information from version_info.txt
    64     # when compiling outside rev control, fetch revision and hash information from version_info.txt
    65     find_file(version_info version_info.txt PATH ${CMAKE_SOURCE_DIR}/share)
    65     find_file(version_info version_info.txt PATH ${CMAKE_SOURCE_DIR}/share)
    66     if(version_info)
    66     if(version_info)
    67         file(STRINGS ${version_info} internal_version REGEX "rev")
    67         file(STRINGS ${version_info} internal_version REGEX "rev")
    68         string(REGEX REPLACE "rev ([0-9]*)" "\\1" revision_number ${internal_version})
    68         string(REGEX REPLACE "rev ([0-9]*)" "\\1" HEDGEWARS_REVISION ${internal_version})
    69         file(STRINGS ${version_info} internal_version REGEX "hash")
    69         file(STRINGS ${version_info} internal_version REGEX "hash")
    70         string(REGEX REPLACE "hash ([a-zA-Z0-9]*)" "\\1" hash_number ${internal_version})
    70         string(REGEX REPLACE "hash ([a-zA-Z0-9]*)" "\\1" HEDGEWARS_HASH ${internal_version})
    71     else()
    71     else()
    72         message(${WARNING} "${CMAKE_SOURCE_DIR}/share/version_info.txt not found, revision information "
    72         message(${WARNING} "${CMAKE_SOURCE_DIR}/share/version_info.txt not found, revision information "
    73                            "will be incorrect!!! Contact your source provider to fix this!")
    73                            "will be incorrect!!! Contact your source provider to fix this!")
    74         set(revision_number "0000")
    74         set(HEDGEWARS_REVISION "0000")
    75         set(hash_number "unknown")
    75         set(HEDGEWARS_HASH "unknown")
    76     endif()
    76     endif()
    77 endif()
    77 endif()
    78 
    78 
    79 
    79 
    80 #versioning
    80 #versioning
    82 set(CPACK_PACKAGE_VERSION_MINOR 9)
    82 set(CPACK_PACKAGE_VERSION_MINOR 9)
    83 set(CPACK_PACKAGE_VERSION_PATCH 19)
    83 set(CPACK_PACKAGE_VERSION_PATCH 19)
    84 set(HEDGEWARS_PROTO_VER 44)
    84 set(HEDGEWARS_PROTO_VER 44)
    85 set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
    85 set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
    86 
    86 
    87 message(STATUS "Building ${HEDGEWARS_VERSION}-r${revision_number} (${hash_number})")
    87 message(STATUS "Building ${HEDGEWARS_VERSION}-r${HEDGEWARS_REVISION} (${HEDGEWARS_HASH})")
    88 
    88 
    89 
    89 
    90 #where to build libs and bins
    90 #where to build libs and bins
    91 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
    91 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
    92 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
    92 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)