Example #1
0
 def test_render(self):
     incdir1 = Version(1,2,3,4)
     result = incdir1.render()
     print(result)
     if result != ['VERSION 1.2.3.4']:
         self.fail("Unexpected result")
     return
Example #2
0
    def __init__(self, name: str, version: Version = None, langs: str = None):
        super().__init__()
        self._Name = None
        self.Name = name
        """Name of the project"""
        self.Version = version
        """Version associated with the project"""
        self.Langs = langs
        """Languages associated with the project"""

        # Set Defaults
        if self.Version is None: self.Version = Version(0,0)
        if self.Langs is None: self.Langs = "C, CXX"
        return
class cmake_minimum_required(ScriptBase):

    """
    CMake Command - Minimum required version of CMake
    """

    def __init__(self, version = None):
        super().__init__()
        self.Version = version
        """Minimum required version of cmake"""
        if self.Version is None: self.Version = Version(2,8)
        return

    def render_body(self):
        ret = []
        ret.append("cmake_minimum_required(" + self.Version.render_string() + ")")
        return ret
Example #4
0
class project(ScriptBase):

    """
    CMake Command - Project Defintion
    """

    def __init__(self, name: str, version: Version = None, langs: str = None):
        super().__init__()
        self._Name = None
        self.Name = name
        """Name of the project"""
        self.Version = version
        """Version associated with the project"""
        self.Langs = langs
        """Languages associated with the project"""

        # Set Defaults
        if self.Version is None: self.Version = Version(0,0)
        if self.Langs is None: self.Langs = "C, CXX"
        return

    @property
    def Name(self):
        """Name of the list / set"""
        return self._Name

    @Name.setter
    def Name(self, value):
        self._Name = value.replace(" ", "_")

    def render_body(self):
        ret = []
        tmpline = "project(" + self.Name + " "
        if self.Version:
            tmpline += self.Version.render_string() + " "
        if self.Langs:
            tmpline += "LANGUAGES " + self.Langs
        tmpline += ")"
        ret.append(tmpline)
        return ret
 def __init__(self, version = None):
     super().__init__()
     self.Version = version
     """Minimum required version of cmake"""
     if self.Version is None: self.Version = Version(2,8)
     return