function (get_temp_path result_variable)
    IF (DEFINED ENV{TMP})
    set (tmp_path "$ENV{TMP}/cmake")
    ELSE ()
    IF (DEFINED ENV{TEMP})
        set (tmp_path "$ENV{TEMP}/cmake")
    ELSE ()
        set (tmp_path "/tmp/cmake")
    ENDIF()
    ENDIF()
    cmake_path(CONVERT ${tmp_path} TO_CMAKE_PATH_LIST tmp_path NORMALIZE)
    IF(NOT EXISTS "${tmp_path}")
    message("creating ${tmp_path}")
    file(MAKE_DIRECTORY "${tmp_path}")
    ELSE()
    message("NOT creating ${tmp_path}")
    ENDIF()
    set(${result_variable} ${tmp_path} PARENT_SCOPE)
endfunction()
