Skip to content

Commit

Permalink
move to shared library format with -DBUILD_SHARED_LIBS (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Nov 5, 2024
1 parent 0936d96 commit 760abde
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ CMakeSettings.json
.idea/
vcpkg-master.zip
vcpkg-master/
include/config.h
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion configure.sh
Original file line number Diff line number Diff line change
@@ -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] =="
Expand Down

0 comments on commit 760abde

Please sign in to comment.