def add_target(self, name, tobj):
    if (name == ''):
        raise InterpreterException('Target name must not be empty.')
    if (name.strip() == ''):
        raise InterpreterException('Target name must not consist only of whitespace.')
    if has_path_sep(name):
        pathseg = os.path.join(self.subdir, os.path.split(name)[0])
        if os.path.exists(os.path.join(self.source_root, pathseg)):
            raise InvalidArguments(textwrap.dedent(f'''                    Target "{name}" has a path segment pointing to directory "{pathseg}". This is an error.
                    To define a target that builds in that directory you must define it
                    in the meson.build file in that directory.
            '''))
    if name.startswith('meson-'):
        raise InvalidArguments("Target names starting with 'meson-' are reserved for Meson's internal use. Please rename.")
    if (name in coredata.FORBIDDEN_TARGET_NAMES):
        raise InvalidArguments(f"Target name '{name}' is reserved for Meson's internal use. Please rename.")
    idname = tobj.get_id()
    if (idname in self.build.targets):
        raise InvalidCode(f'Tried to create target "{name}", but a target of that name already exists.')
    self.build.targets[idname] = tobj
    if (idname not in self.coredata.target_guids):
        self.coredata.target_guids[idname] = str(uuid.uuid4()).upper()
def add_target(self, name, tobj):
    if (name == ):
        raise InterpreterException('Target name must not be empty.')
    if (name.strip() == ):
        raise InterpreterException('Target name must not consist only of whitespace.')
    if has_path_sep(name):
        pathseg = os.path.join(self.subdir, os.path.split(name)[0])
        if os.path.exists(os.path.join(self.source_root, pathseg)):
            raise InvalidArguments(textwrap.dedent(f'                    Target "{name}" has a path segment pointing to directory "{pathseg}". This is an error.
                    To define a target that builds in that directory you must define it
                    in the meson.build file in that directory.
            '))
    if name.startswith('meson-'):
        raise InvalidArguments("Target names starting with 'meson-' are reserved for Meson's internal use. Please rename.")
    if (name in coredata.FORBIDDEN_TARGET_NAMES):
        raise InvalidArguments(f"Target name '{name}' is reserved for Meson's internal use. Please rename.")
    idname = tobj.get_id()
    if (idname in self.build.targets):
        raise InvalidCode(f'Tried to create target "{name}", but a target of that name already exists.')
    self.build.targets[idname] = tobj
    if (idname not in self.coredata.target_guids):
        self.coredata.target_guids[idname] = str(uuid.uuid4()).upper()