[CMake] why no cumulative variable operations via the commandline?

Nicholas Braden nicholas11braden at gmail.com
Sat Mar 19 09:41:13 EDT 2016


The command line is the first point where variables can be defined
(all code runs after this), so I am not sure where you expect
pre-existing values to come from in order for a += or -= to make
sense. Could you give an example of when you would find them useful? I
think maybe I am not understanding what you want.

If you just want to pass a list of values to a variable on the command
line, separate the values with semicolons:
cmake "-DMY_LIST=example value 1;example value 2"

On Sat, Mar 19, 2016 at 4:52 AM, René J. V. <rjvbertin at gmail.com> wrote:
> Hi,
>
> I've been wondering about something that is a real stumbling block in a
> build/distribution system like MacPorts where settings can be modified in any
> number of consecutive steps. For instance, depending on what dependencies a
> package ("port") requires and how those dependencies are installed, elements may
> be added to the module search path repeatedly.
>
> In cmake language one does cumulative operations like that explicitly, but I'm
> not aware of any way to do that on the command line.
>
> Is there a reason why one cannot do something like
>
> cmake -DCMAKE_FOO+=bar
>
> or
>
> CMAKE -ACMAKE_FOO=bar (-A for add instead of define)
>
> (or -DCMAKE_FOO-=bar, for that matter...) ?
>
> Thanks,
> René
>
> --
>
> 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


More information about the CMake mailing list