-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have run on behaviour of cmake that I really do not understand (even
if I have clues)... This is probably stupid, but I'm puzzled...

The attached CMakeLists.txt gives the following output:

::-B-::  <- This shows that B is indeed parsed as OPTIONAL
A
A        <- Fine I'm in the else part of the if
OPTIONAL
HERE     <- Fine.
B
HERE     <- ???????

Tested on cmake 2.3.4 and 2.8.12.2.
Of course this is related to the reuse of TOTO both as a variable name
and as a variable content.... but this seems really error prone.

        Thank's for any clue.

        Theo Papadopoulo.
        
PS: I'm clearly supporting the addition of a continue() command:

http://public.kitware.com/Bug/bug_relationship_graph.php?bug_id=14013&graph=relation

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEUEARECAAYFAlNH3hQACgkQEr8WrU8nPV2BZgCXbxsiijX9dQD0TlfIGQa5bIfj
0QCfZffqFn0WpoFEAv1oBrF6fVF62JY=
=ooMR
-----END PGP SIGNATURE-----
cmake_minimum_required(VERSION 2.8)

project(Test)

set(DEFAULT A)
set(TOTO B)
message("::-${TOTO}-::")
foreach(arg ${DEFAULT} TOTO ${TOTO})
    message("${arg}")
    if ("${arg}" STREQUAL "TOTO")
        message("HERE")
    else()
        message("${arg}")
    endif()
endforeach()
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to