I am doing the following:

```
set( CS_THIRD_PARTY_REFERENCES
    Iconic.Zip ${CMAKE_CURRENT_SOURCE_DIR}/DotNetZip/Iconic.Zip.dll
)

if( CS_THIRD_PARTY_REFERENCES )
    list( LENGTH CS_THIRD_PARTY_REFERENCES len )
    message( STATUS "len: ${len}" )
    foreach( i RANGE 0 ${len} 2 )
        message( STATUS "i: ${i}" )
        list( GET CS_THIRD_PARTY_REFERENCES ${i} assembly_name )
        math( EXPR i "${i}+1" )
        list( GET CS_THIRD_PARTY_REFERENCES ${i} assembly_path )
        set_property( TARGET ${target_name} PROPERTY
            VS_DOTNET_REFERENCE_${assembly_name} ${assembly_path}
        )
        message( STATUS "i: ${i}" )
        message( STATUS "assembly_name: ${assembly_name}" )
        message( STATUS "assembly_path: ${assembly_path}" )
    endforeach()
endif()
```

I am finding that the foreach() loops 2 times when ${len} is 2. What I
expect during the 2nd iteration is that it does ${i}+STEP (0+2) which
would equal 2, and so long as 2<${len} (2<2), then it would continue
to iterate. In this case, it should stop after the first iteration.
I'm thinking that this should work like a C++ for loop. Is this not
the case? How should I be iterating over a list of 2 times at a time?
-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to