[CMake] ARGC != list(LENGTH ARGV) and ARGV0 != list(GET ARGV 0)

Clark WANG dearvoid at gmail.com
Fri Oct 11 00:07:58 EDT 2013


See following example:

    $ cmake --version
    cmake version 2.8.11.2
    $ cat CMakeLists.txt
    cmake_minimum_required(VERSION 2.8)

    FUNCTION(foo)
        list(LENGTH ARGV argc)
        message("ARGC=${ARGC} list(LENGTH ARGV)=${argc}")

        list(GET ARGV 0 argv0)
        message("ARGV0=${ARGV0} list(GET ARGV 0)=${argv0}")
    ENDFUNCTION()

    foo("a;b;c")
    $ cmake .
    ARGC=1 list(LENGTH ARGV)=3
    ARGV0=a;b;c list(GET ARGV 0)=a
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /root/tmp
    $

I know ';' is special in cmake but it's counter-intuitive that ARGC !=
list(LENGTH ARGV). Is this a bug?

-Clark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131011/1d70c0b2/attachment.htm>


More information about the CMake mailing list