def add_pch(self, language, pchlist):
    if (not pchlist):
        return
    elif (len(pchlist) == 1):
        if (not environment.is_header(pchlist[0])):
            raise InvalidArguments(('PCH argument %s is not a header.' % pchlist[0]))
    elif (len(pchlist) == 2):
        if environment.is_header(pchlist[0]):
            if (not environment.is_source(pchlist[1])):
                raise InvalidArguments('PCH definition must contain one header and at most one source.')
        elif environment.is_source(pchlist[0]):
            if (not environment.is_header(pchlist[1])):
                raise InvalidArguments('PCH definition must contain one header and at most one source.')
            pchlist = [pchlist[1], pchlist[0]]
        else:
            raise InvalidArguments(('PCH argument %s is of unknown type.' % pchlist[0]))
        if (os.path.dirname(pchlist[0]) != os.path.dirname(pchlist[1])):
            raise InvalidArguments('PCH files must be stored in the same folder.')
    elif (len(pchlist) > 2):
        raise InvalidArguments('PCH definition may have a maximum of 2 files.')
    for f in pchlist:
        if (not os.path.isfile(os.path.join(self.environment.source_dir, self.subdir, f))):
            raise MesonException(('File %s does not exist.' % f))
    self.pch[language] = pchlist
def add_pch(self, language, pchlist):
    if (not pchlist):
        return
    elif (len(pchlist) == 1):
        if (not environment.is_header(pchlist[0])):
            raise InvalidArguments(('PCH argument %s is not a header.' % pchlist[0]))
    elif (len(pchlist) == 2):
        if environment.is_header(pchlist[0]):
            if (not environment.is_source(pchlist[1])):
                raise InvalidArguments('PCH definition must contain one header and at most one source.')
        elif environment.is_source(pchlist[0]):
            if (not environment.is_header(pchlist[1])):
                raise InvalidArguments('PCH definition must contain one header and at most one source.')
            pchlist = [pchlist[1], pchlist[0]]
        else:
            raise InvalidArguments(('PCH argument %s is of unknown type.' % pchlist[0]))
        if (os.path.dirname(pchlist[0]) != os.path.dirname(pchlist[1])):
            raise InvalidArguments('PCH files must be stored in the same folder.')
    elif (len(pchlist) > 2):
        raise InvalidArguments('PCH definition may have a maximum of 2 files.')
    for f in pchlist:
        if (not os.path.isfile(os.path.join(self.environment.source_dir, self.subdir, f))):
            raise MesonException(('File %s does not exist.' % f))
    self.pch[language] = pchlist