1 function(TEMPORARY_DIRECTORY)
2 if(NOT DEFINED TEMPORARY_DIRECTORY)
3 if(DEFINED ENV{TMPDIR})
4 set(TEMPORARY_DIRECTORY $ENV{TMPDIR})
5 elseif(DEFINED ENV{TEMP})
6 set(TEMPORARY_DIRECTORY $ENV{TEMP})
7 elseif(DEFINED ENV{TMP})
8 set(TEMPORARY_DIRECTORY $ENV{TMP})
11 if(NOT DEFINED TEMPORARY_DIRECTORY)
12 find_program(MKTEMP NAMES mktemp)
13 if(EXISTS "${MKTEMP}")
14 execute_process(COMMAND ${MKTEMP} -d OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE dir RESULT_VARIABLE result)
16 get_filename_component(TEMPORARY_DIRECTORY "${dir}" DIRECTORY)
20 if(DEFINED TEMPORARY_DIRECTORY)
21 set(TEMPORARY_DIRECTORY ${TEMPORARY_DIRECTORY} CACHE PATH "Path to system temporary directory.")
24 if(NOT DEFINED TEMPORARY_DIRECTORY)