CMakePP / CMakePPLang

Object-oriented extension to the CMake language.
http://cmakepp.github.io/CMakePPLang/
Apache License 2.0
11 stars 4 forks source link

kwargs ctor #7

Closed ryanmrichard closed 4 years ago

ryanmrichard commented 4 years ago

if we define three types of attributes (toggles/flags, options, and lists) we can map cmake_parse_arguments to an object's attributes in a relatively automated way.

Basically:

MyObject(CTOR the_obj A_FLAG)

would set the toggle attribute a_flag to TRUE (if A_FLAG doesn't appear it would default to FALSE),

MyObject(CTOR the_obj AN_OPTION foo)

would set the option attribute an_option to foo, and:

MyObject(CTOR the_obj A_LIST foo bar baz)

would set the list attribute a_list to foo;bar;baz. This in turn provides an easy way for to initialize an object given the kwargs a user provided.