<commit_before>
find_package(Git)
set_package_properties(Git PROPERTIES DESCRIPTION "Distributed Version Control" URL "www.git-scm.com")
set_package_properties(Git PROPERTIES TYPE OPTIONAL PURPOSE "For extracting the currect version of the Bohrium source")

# We either extract the version using git or by reading the VERSION file
if(GIT_FOUND)
    message("git found: ${GIT_EXECUTABLE}")

    execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --match v[0-9]* --abbrev=0 --always
                    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
                    OUTPUT_VARIABLE _VERSION_STRING
                    OUTPUT_STRIP_TRAILING_WHITESPACE)
    string(REPLACE "v" "" BH_VERSION_STRING ${_VERSION_STRING}) # removing the "v"

    # Save version to file (which will be used when Git is not available)
    file(WRITE ${CMAKE_SOURCE_DIR}/VERSION ${BH_VERSION_STRING})
else()
    file(READ ${CMAKE_SOURCE_DIR}/VERSION BH_VERSION_STRING)
endif()


# Then we extract the MAJOR, MINOR, and PATCH version
message("BH_VERSION_STRING: ${BH_VERSION_STRING}")
if("${BH_VERSION_STRING}" MATCHES "v([0-9]+)\\.([0-9]+)")
    set(${BH_VERSION_MAJOR} ${CMAKE_MATCH_1})<commit_msg>cmake: fixed version in tarball<commit_after># This file defines BH_VERSION_STRING, BH_VERSION_MAJOR, BH_VERSION_MINOR, and BH_VERSION_PATCH

find_package(Git)
set_package_properties(Git PROPERTIES DESCRIPTION "Distributed Version Control" URL "www.git-scm.com")
set_package_properties(Git PROPERTIES TYPE OPTIONAL PURPOSE "For extracting the currect version of the Bohrium source")

# Let's try to extract the version using git
if(GIT_FOUND)
    execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --match v[0-9]* --abbrev=0 --always
            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
            OUTPUT_VARIABLE _VERSION_STRING
            OUTPUT_STRIP_TRAILING_WHITESPACE)
    string(REPLACE "v" "" BH_VERSION_STRING ${_VERSION_STRING}) # removing the "v"
endif()

# If the extraction failed, read the VERSION file
if (BH_VERSION_STRING STREQUAL "")
    file(READ ${CMAKE_SOURCE_DIR}/VERSION BH_VERSION_STRING)
else()
    # Else, write to the version to file for later use
    file(WRITE ${CMAKE_SOURCE_DIR}/VERSION ${BH_VERSION_STRING})
endif()
message(STATUS "BH_VERSION_STRING: \"${BH_VERSION_STRING}\"")


# Then we extract the MAJOR, MINOR, and PATCH version
message("BH_VERSION_STRING: ${BH_VERSION_STRING}")
if("${BH_VERSION_STRING}" MATCHES "v([0-9]+)\\.([0-9]+)")
    set(${BH_VERSION_MAJOR} ${CMAKE_MATCH_1})
{'fraction_non_alphanumeric': 0.10844337735094038, 'fraction_numerical': 0.006402561024409764, 'mean_word_length': 4.938242280285036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5976816', 'n_tokens_mistral': 868, 'n_tokens_neox': 806, 'n_words': 211}