From 8a408b4c95a5e6be2808ef9516bcbebddf8b09a6 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 28 Mar 2020 19:19:22 +0000 Subject: project.boost: factor out Configuration/Platform/Linkage --- project/linkage.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 project/linkage.py (limited to 'project/linkage.py') diff --git a/project/linkage.py b/project/linkage.py new file mode 100644 index 0000000..7019049 --- /dev/null +++ b/project/linkage.py @@ -0,0 +1,26 @@ +# Copyright (c) 2020 Egor Tensin +# This file is part of the "cmake-common" project. +# For details, see https://github.com/egor-tensin/cmake-common. +# Distributed under the MIT License. + +import argparse +from enum import Enum + + +class Linkage(Enum): + STATIC = 'static' + SHARED = 'shared' + + def __str__(self): + return self.value + + @staticmethod + def all(): + return tuple(Linkage) + + @staticmethod + def parse(s): + try: + return Linkage(s) + except ValueError: + raise argparse.ArgumentTypeError(f'invalid linkage: {s}') -- cgit v1.2.3