Skip to content

Commit

Permalink
Add LIBB64_SHARED option for fine-grained library type control (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedld committed Feb 10, 2023
1 parent 91a3851 commit 64ab5ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(LIBB64_STANDALONE_BUILD ON)
endif()

option(LIBB64_SHARED "${PROJECT_NAME}: Build shared library" ${BUILD_SHARED_LIBS})
option(LIBB64_ENABLE_INSTALL "${PROJECT_NAME}: Enable install" ${LIBB64_STANDALONE_BUILD})
option(LIBB64_ENABLE_TESTS "${PROJECT_NAME}: Enable tests" ${LIBB64_STANDALONE_BUILD})
option(LIBB64_ENABLE_WERROR "${PROJECT_NAME}: Treat warnings as errors" ${LIBB64_STANDALONE_BUILD})
Expand Down Expand Up @@ -47,6 +48,11 @@ if(LIBB64_STANDALONE_BUILD)
endif()
endif()

set(LIBB64_LIBRARY_TYPE STATIC)
if(LIBB64_SHARED)
set(LIBB64_LIBRARY_TYPE SHARED)
endif()

add_subdirectory(src)

if(LIBB64_BUILD_PROGRAMS)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_library(libb64
add_library(libb64 ${LIBB64_LIBRARY_TYPE}
../include/b64/cencode.h
../include/b64/cdecode.h
../include/b64/ccommon.h
Expand Down

0 comments on commit 64ab5ed

Please sign in to comment.