From 660cc22b74a1bad7a97619dca56eb78a9f23e180 Mon Sep 17 00:00:00 2001 From: filipwasil Date: Sun, 15 May 2016 15:47:55 +0200 Subject: [PATCH] Enable building as shared library --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4f497a..e43ea57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,11 +22,14 @@ set(tinyobjloader-examples-objsticher ${TINYOBJLOADEREXAMPLES_DIR}/obj_sticher/obj_sticher.cc ) -add_library(tinyobjloader - ${tinyobjloader-Source} - ) - option(TINYOBJLOADER_BUILD_TEST_LOADER "Build Example Loader Application" OFF) +option(TINYOBJLOADER_COMPILATION_SHARED "Build as shared library" OFF) + +if (TINYOBJLOADER_COMPILATION_SHARED) + add_library(tinyobjloader SHARED ${tinyobjloader-Source}) +else() + add_library(tinyobjloader STATIC ${tinyobjloader-Source}) +endif() if(TINYOBJLOADER_BUILD_TEST_LOADER) add_executable(test_loader ${tinyobjloader-Example-Source})