The problem is that srand is called *each* time that STRING(RANDOM is invoked... And it is based on the current time stamp to the nearest second. (Not exactly random if it&#39;s exactly correlated to what second it currently is...)<br>
<br>I agree, this is a bug.<br><br>Would you submit a bug report in the bug tracker?<br><br>Would anyone object to changing this to call srand only on the very first call to STRING(RANDOM in a given invocation of cmake? (Or does somebody have a better suggestion? Perhaps passing the seed value in as an optional parameter...?)<br>
<br><br>Thx,<br>David<br><br><br><div class="gmail_quote">On Thu, Nov 5, 2009 at 8:41 AM, Marcel Loose <span dir="ltr">&lt;<a href="mailto:loose@astron.nl">loose@astron.nl</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
I expected that string(RANDOM...) would produce a different string each<br>
time it is invoked. Turns out that this string is only different between<br>
different cmake runs. This is not what I expected. IMHO this is a bug,<br>
either in the code, or in the documentation.<br>
<br>
$ cat ../CMakeLists.txt<br>
project(Dummy NONE)<br>
cmake_minimum_required(VERSION 2.6)<br>
string(RANDOM a)<br>
string(RANDOM b)<br>
message(STATUS &quot;a=${a}&quot;)<br>
message(STATUS &quot;b=${b}&quot;)<br>
<br>
$ cmake ..<br>
-- a=PgDGb<br>
-- b=PgDGb<br>
-- Configuring done<br>
-- Generating done<br>
-- Build files have been written to: /tmp/loose/cmake/build<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>