diff --git a/.gitignore b/.gitignore index 36392e0..8bda252 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ CMakeSettings.json .idea/ vcpkg-master.zip vcpkg-master/ +include/config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index c2610db..f0660cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,18 @@ set(MINIO_CPP_HEADERS include/miniocpp/utils.h ) -add_library(miniocpp STATIC ${MINIO_CPP_SOURCES} ${MINIO_CPP_HEADERS}) +option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) + +IF (BUILD_SHARED_LIBS) + IF (WIN32) + message(FATAL_ERROR "Unable to build shared library on Windows yet, this library lacks decorator support.") + ELSE () + add_library(miniocpp SHARED ${MINIO_CPP_SOURCES} ${MINIO_CPP_HEADERS}) + ENDIF () +ELSE () + add_library(miniocpp STATIC ${MINIO_CPP_SOURCES} ${MINIO_CPP_HEADERS}) +ENDIF () + target_compile_options(miniocpp PRIVATE ${MINIO_CPP_CFLAGS}) target_compile_features(miniocpp PUBLIC cxx_std_${MINIO_CPP_STD}) target_include_directories(miniocpp PUBLIC diff --git a/configure.sh b/configure.sh index 166c412..eac8b71 100755 --- a/configure.sh +++ b/configure.sh @@ -1,9 +1,10 @@ #!/bin/sh +set -x BUILD_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" if [ -n "$VCPKG_ROOT" ]; then - BUILD_OPTIONS="${BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + BUILD_OPTIONS="${BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" fi echo "== [Configuring Build - Debug] =="