Cache variable BUILD_SHARED_LIBS

This commit is contained in:
Jonah Beckford 2023-09-25 15:31:29 -07:00
parent b6e04c7d38
commit 9bc6befee7
2 changed files with 17 additions and 8 deletions

View file

@ -1,5 +1,13 @@
# Changes
## 0.9.1
- (backwards incompatible) Add CMake cache variable `BUILD_SHARED_LIBS`.
The default is a static library for mobile (Android and iOS), and a
shared library otherwise; that is the same pattern followed by opencv.
The variable should be explicitly set to `ON` if a shared library must
be created, and `OFF` if a static library must be created.
## 0.9.0
- Forked to the DkML repository on GitLab.
@ -11,7 +19,9 @@
- Wrap macro parameters in the `capnp_use(x)` macro. Passes clang-tidy (not
a false positive)
- Add POSITION_INDEPENDENT_CODE to CapnC::Runtime
- Add C_CAPNPROTO_ENABLE_INSTALL with default ON to enable cmake --install
- Add C_CAPNPROTO_ENABLE_INSTALL with default ON to turn off and on
installation of targets and files in `cmake --install`, especially for when
this project is used within a FetchContent() command.
## 0.3 (632f0d73a1f4a03026b5e4727386b9fe3ec6e00e)

View file

@ -24,13 +24,12 @@ if(APPLE)
set(CMAKE_MACOSX_RPATH OFF)
endif()
# Boilerplate DK CMAKE PROJ 2023-05-17.2
if(BUILD_SHARED_LIBS)
# SHARED is implied by BUILD_SHARED_LIBS=ON
set(linkage)
else()
set(linkage STATIC)
# Boilerplate DK CMAKE PROJ 2023-09-25.1
set(default_build_shared)
if(NOT (ANDROID OR IOS))
set(default_build_shared ON)
endif()
option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" ${default_build_shared})
# Build hygiene: Tools for keeping the source code clean. By default
# we try to enforce build hygiene.
@ -52,7 +51,7 @@ if(NOT BUILD_HYGIENE STREQUAL DISABLED)
${find_program_args})
endif()
add_library(CapnC_Runtime ${linkage}
add_library(CapnC_Runtime
lib/capn.c
lib/capn-malloc.c
lib/capn-stream.c