Works for me with CMake 3.2.1 on Windows. What version of CMake are you using?
C:\dev\dcole> type args.cmake foreach(n RANGE ${ARGC}) message(STATUS "${n} ${CMAKE_ARGV${n}}") endforeach() message(STATUS "${CMAKE_ARGV0}") message(STATUS "${CMAKE_ARGV1}") message(STATUS "${CMAKE_ARGV2}") C:\dev\dcole> cmake -P args.cmake -- 0 cmake -- cmake -- -P -- args.cmake C:\dev\dcole> cmake --version cmake version 3.2.1 CMake suite maintained and supported by Kitware (kitware.com/cmake). On Fri, Mar 13, 2015 at 7:50 PM, Bill Newcomb <bnewc...@nvidia.com> wrote: > Any idea what I'm doing wrong here? > > $ cat foo.cmake > foreach(n RANGE ${ARGC}) > message(STATUS "${n} ${CMAKE_ARGV${n}}") > endforeach() > message(STATUS "${CMAKE_ARGV0}") > message(STATUS "${CMAKE_ARGV1}") > message(STATUS "${CMAKE_ARGV2}") > > $ cmake -P foo.cmake a b c > -- 0 > -- > -- > -- > $ cmake a b c -P foo.cmake > -- 0 > -- > -- > -- > > > Thanks, > B. > > ----------------------------------------------------------------------------------- > This email message is for the sole use of the intended recipient(s) and may > contain > confidential information. Any unauthorized review, use, disclosure or > distribution > is prohibited. If you are not the intended recipient, please contact the > sender by > reply email and destroy all copies of the original message. > ----------------------------------------------------------------------------------- > -- > > 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://public.kitware.com/mailman/listinfo/cmake -- 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://public.kitware.com/mailman/listinfo/cmake