From 1f1318d0e1afa560e889ba695f6fc0f56bc30664 Mon Sep 17 00:00:00 2001 From: IoIxD Date: Wed, 7 Jan 2026 12:30:18 -0700 Subject: [PATCH] cmake: allow shared or static building --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca3c765..37e23d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,8 @@ option(BUILD_EXAMPLES "Build examples" OFF) option(USE_STB_IMAGE "Use stb_image" ON) option(USE_STB_TRUETYPE "Use stb_truetype" OFF) option(USE_FREETYPE2 "Use FreeType 2" ON) +option(BUILD_SHARED "Build a shared library" ON) +option(BUILD_STATIC "Build a static library" OFF) file( GLOB @@ -61,11 +63,22 @@ if(TRY_OPENGL) endif() endif() +if(BUILD_STATIC) +message(STATUS "Building Milsko as a static library") +add_library( + Mw + ${SOURCES} +) +elseif(BUILD_SHARED) +message(STATUS "Building Milsko as a shared library") add_library( Mw SHARED ${SOURCES} ) +else() +message(ERROR "Must either build a shared library or a static library") +endif() if(USE_STB_IMAGE) target_compile_definitions(