if (NOT DEFINED ENV{PROJECT_VERSION_BUILD_META} AND NOT DEFINED ENV{PROJECT_VERSION_BUILD_RELEASE})
    cmake_host_system_information(RESULT BUILD_MACHINE QUERY HOSTNAME)
    if (DEFINED ENV{USER})
        set(BUILD_USER $ENV{USER})
    elseif(DEFINED ENV{USERNAME})
        set(BUILD_USER $ENV{USERNAME})
    endif()

    set(BUILD_META_PREFIX "+")
    set(BUILD_META "")
    if (BUILD_USER)
        set(BUILD_META "${BUILD_META}${BUILD_META_PREFIX}by.${BUILD_USER}")
        set(BUILD_META_PREFIX ".")
    endif()
    if (BUILD_MACHINE)
        set(BUILD_META "${BUILD_META}${BUILD_META_PREFIX}at.${BUILD_MACHINE}")
        set(BUILD_META_PREFIX ".")
    endif()
    if (BUILD_META)
        set(ENV{PROJECT_VERSION_BUILD_META} ${BUILD_META})
    endif()
endif()

if (DEFINED ENV{PROJECT_VERSION_BUILD_META})
    set(PROJECT_VERSION_BUILD_META $ENV{PROJECT_VERSION_BUILD_META}
        CACHE STRING "" FORCE)
endif()
