[CMake] string(RANDOM) bug?

Marcel Loose loose at astron.nl
Fri Nov 6 03:18:33 EST 2009


Hi David,

I submitted a bug report: http://www.cmake.org/Bug/view.php?id=9851

Best regards,
Marcel Loose.

On Thu, 2009-11-05 at 11:14 -0500, David Cole wrote:
> 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's exactly correlated to what second
> it currently is...)
> 
> I agree, this is a bug.
> 
> Would you submit a bug report in the bug tracker?
> 
> 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...?)
> 
> 
> Thx,
> David
> 
> 
> On Thu, Nov 5, 2009 at 8:41 AM, Marcel Loose <loose at astron.nl> wrote:
>         Hi all,
>         
>         I expected that string(RANDOM...) would produce a different
>         string each
>         time it is invoked. Turns out that this string is only
>         different between
>         different cmake runs. This is not what I expected. IMHO this
>         is a bug,
>         either in the code, or in the documentation.
>         
>         $ cat ../CMakeLists.txt
>         project(Dummy NONE)
>         cmake_minimum_required(VERSION 2.6)
>         string(RANDOM a)
>         string(RANDOM b)
>         message(STATUS "a=${a}")
>         message(STATUS "b=${b}")
>         
>         $ cmake ..
>         -- a=PgDGb
>         -- b=PgDGb
>         -- Configuring done
>         -- Generating done
>         -- Build files have been written to: /tmp/loose/cmake/build
>         
>         
>         _______________________________________________
>         Powered by www.kitware.com
>         
>         Visit other Kitware open-source projects at
>         http://www.kitware.com/opensource/opensource.html
>         
>         Please keep messages on-topic and check the CMake FAQ at:
>         http://www.cmake.org/Wiki/CMake_FAQ
>         
>         Follow this link to subscribe/unsubscribe:
>         http://www.cmake.org/mailman/listinfo/cmake
> 



More information about the CMake mailing list