Honor the standard BUILD_SHARED_LIBS cmake variable.
The variable switches the default type for add_library from STATIC to SHARED. We can condition additional stuff on that for convenience. (tabtest still doesn't build.) BoringSSL as any kind of stable system shared library is still very much unsupported, but this is probably handy for making sure we don't forget all those pesky OPENSSL_EXPORTs. Change-Id: I66ab80bcddbf3724e03e85384141fdf4f4acbc2e Reviewed-on: https://boringssl-review.googlesource.com/3092 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
f4600adb0e
commit
507c1eec51
12
BUILDING
12
BUILDING
@ -40,7 +40,7 @@ You usually don't need to run cmake again after changing CMakeLists.txt files
|
||||
because the build scripts will detect changes to them and rebuild themselves
|
||||
automatically.
|
||||
|
||||
Note that the default build flags in the top-leve CMakeLists.txt are for
|
||||
Note that the default build flags in the top-level CMakeLists.txt are for
|
||||
debugging - optimisation isn't enabled.
|
||||
|
||||
If you want to cross-compile then there are example toolchain files for 32-bit
|
||||
@ -49,12 +49,10 @@ like this:
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../util/arm-toolchain.cmake -GNinja ..
|
||||
|
||||
If you want to build as a shared library you need to tweak the STATIC tags in
|
||||
the CMakeLists.txts and also define BORINGSSL_SHARED_LIBRARY and
|
||||
BORINGSSL_IMPLEMENTATION. On Windows, where functions need to be tagged with
|
||||
"dllimport" when coming from a shared library, you need just
|
||||
BORINGSSL_SHARED_LIBRARY defined in the code which #includes the BoringSSL
|
||||
headers.
|
||||
If you want to build as a shared library, pass -DBUILD_SHARED_LIBS=1. On
|
||||
Windows, where functions need to be tagged with "dllimport" when coming from a
|
||||
shared library, define BORINGSSL_SHARED_LIBRARY in any code which #includes the
|
||||
BoringSSL headers.
|
||||
|
||||
Known Limitations on Windows:
|
||||
|
||||
|
@ -19,6 +19,13 @@ endif()
|
||||
|
||||
add_definitions(-DBORINGSSL_IMPLEMENTATION)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_definitions(-DBORINGSSL_SHARED_LIBRARY)
|
||||
# Enable position-independent code globally. This is needed because
|
||||
# some library targets are OBJECT libraries.
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
endif()
|
||||
|
||||
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
|
||||
set(ARCH "x86_64")
|
||||
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
|
||||
|
@ -134,7 +134,6 @@ add_subdirectory(pkcs8)
|
||||
|
||||
add_library(
|
||||
crypto
|
||||
STATIC
|
||||
|
||||
crypto.c
|
||||
crypto_error.c
|
||||
|
@ -4,7 +4,6 @@ add_subdirectory(pqueue)
|
||||
|
||||
add_library(
|
||||
ssl
|
||||
STATIC
|
||||
|
||||
d1_both.c
|
||||
d1_clnt.c
|
||||
|
Loading…
Reference in New Issue
Block a user