# Developer-defined utilities used through the package.

# clears all passed variables
macro(tbp_clear_vars)
    foreach(_var ${ARGN})
        unset(${_var})
        unset(${_var} CACHE)
    endforeach()
endmacro()

# update variable
macro(tbp_update VAR)
    if(NOT DEFINED ${VAR})
        if("x${ARGN}" STREQUAL "x")
            set(${VAR} "")
        else()
            set(${VAR} ${ARGN})
        endif()
    endif()
endmacro()

# check if we are compiling in root directory
macro(tbp_check_build_dir)
    if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
        message(FATAL_ERROR "FATAL: In-source builds are not allowed.
            You should create a separate directory for build files.\n")
    endif()
endmacro()