[CMake] Fwd: Finding the "Temp" directory code

Eric Noulard eric.noulard at gmail.com
Sat Nov 14 05:02:04 EST 2009


---------- Forwarded message ----------
From: Eric Noulard <eric.noulard at gmail.com>
Date: 2009/11/14
Subject: Re: [CMake] Finding the "Temp" directory code
To: Michael Wild <themiwi at gmail.com>


2009/11/14 Michael Wild <themiwi at gmail.com>:
>
> On 14. Nov, 2009, at 24:55 , Michael Jackson wrote:
>
>> Does anyone have any CMake code to find the designated temp folder
>> location for each platform? Was thinking this might be in CMake somewhere
>> but I did not seem to find anything.
>>
>> Thanks
>>
>
> I think on WIN32 its TEMP and TMP and on all UNIX I kno of its TMPDIR.

On my Linux box there is neither TEMP/TMP/TMPDIR env var defined.
Usually "/tmp" is a good bet.

Moreover if you machine is used by multiple user
**at the same time** which tends to be the case for some Unix
machine.

You should usually find a TEMP location which is user specific
because if not you may end up with multiple user access the same
"TEMP".

On unix you have tmpnam(3), tmpfile(3) which should gives you
appropriate system-unique temporary name/file.

It doesn't really help for the initial question but I wanted to
notice that once you found TMP folder you may have to build
appropriate uniquely named subfolder in order to avoid
possible multi-user name clash.

--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list