use literal
This commit is contained in:
parent
b9254d0cdc
commit
11dcaf7ca7
@ -1,6 +1,10 @@
|
|||||||
from typing import Self
|
from typing import Literal, Self, Type, TypeVar
|
||||||
from .tools import *
|
from .tools import *
|
||||||
from .values import *
|
from .values import *
|
||||||
|
|
||||||
|
ModesPPI = Literal["PUBLIC","PRIVATE","INTERFACE"]
|
||||||
|
ModesSSM = Literal["STATIC","SHARED","MODULE"]
|
||||||
|
|
||||||
class cmake:
|
class cmake:
|
||||||
__write_stack__:List[str] = []
|
__write_stack__:List[str] = []
|
||||||
__file_name__:str
|
__file_name__:str
|
||||||
@ -22,7 +26,7 @@ class cmake:
|
|||||||
self.__write_stack__.append(f"add_executable({name} {args_to_str(source)})")
|
self.__write_stack__.append(f"add_executable({name} {args_to_str(source)})")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def add_library(self,name:str=var(project_name),mode:str=static,*source:str)->Self:
|
def add_library(self,name:str=var(project_name),mode:ModesSSM="STATIC",*source:str)->Self:
|
||||||
"""
|
"""
|
||||||
ARGS:
|
ARGS:
|
||||||
mode: mode can be STATIC , SHARED or MODULE
|
mode: mode can be STATIC , SHARED or MODULE
|
||||||
@ -30,7 +34,7 @@ class cmake:
|
|||||||
self.__write_stack__.append(f"add_library({name} {mode} {args_to_str(source)})")
|
self.__write_stack__.append(f"add_library({name} {mode} {args_to_str(source)})")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def target_include_directories(self,for_project:str=var(project_name),mode:str=public,*directories:str)->Self:
|
def target_include_directories(self,for_project:str=var(project_name),mode:ModesPPI="PUBLIC",*directories:str)->Self:
|
||||||
"""
|
"""
|
||||||
ARGS:
|
ARGS:
|
||||||
mode : mode can be PUBLIC PRIVATE INTERFACE
|
mode : mode can be PUBLIC PRIVATE INTERFACE
|
||||||
@ -42,11 +46,11 @@ class cmake:
|
|||||||
self.__write_stack__.append(f"set({name} {value})")
|
self.__write_stack__.append(f"set({name} {value})")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def target_link_libraries(self,lib_name:str,name:str=var(project_name),mode:str=public)->Self:
|
def target_link_libraries(self,lib_name:str,name:str=var(project_name),mode:ModesPPI="PUBLIC")->Self:
|
||||||
self.__write_stack__.append(f"target_link_libraries({name} {mode} {lib_name})")
|
self.__write_stack__.append(f"target_link_libraries({name} {mode} {lib_name})")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def target_link_directories(self,name:str=var(project_name),mode:str=public,*directories:str)->Self:
|
def target_link_directories(self,name:str=var(project_name),mode:ModesPPI="PUBLIC",*directories:str)->Self:
|
||||||
self.__write_stack__.append(f"target_link_directories({name} {mode} {args_to_str(directories)})")
|
self.__write_stack__.append(f"target_link_directories({name} {mode} {args_to_str(directories)})")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user