Unverified Commit c487f53c authored by Davide Beatrici's avatar Davide Beatrici Committed by Jean-Marc Valin
Browse files

CMake: add option to set BUILD_SHARED_LIBS variable

From https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html

:

"Global flag to cause add_library() to create shared libraries if on.

If present and true, this will cause all libraries to be built shared unless the library was explicitly added as a static library. This variable is often added to projects as an option() so that each user of a project can decide if they want to build the project using shared or static libraries."
Signed-off-by: Jean-Marc Valin's avatarJean-Marc Valin <jmvalin@jmvalin.ca>
parent 93b373e8
......@@ -18,6 +18,7 @@ message(STATUS "Opus project version: ${PROJECT_VERSION}")
project(Opus LANGUAGES C VERSION ${PROJECT_VERSION})
include(opus_buildtype.cmake)
option(OPUS_BUILD_SHARED_LIBRARY "Build shared library" OFF)
option(OPUS_STACK_PROTECTOR "Use stack protection" ON)
option(OPUS_USE_ALLOCA "Use alloca for stack arrays (on non-C99 compilers)" OFF)
option(OPUS_CUSTOM_MODES "Enable non-Opus modes, e.g. 44.1 kHz & 2^n frames"
......@@ -38,6 +39,11 @@ include(GNUInstallDirs)
include(CMakeDependentOption)
include(FeatureSummary)
if(OPUS_BUILD_SHARED_LIBRARY)
# Global flag to cause add_library() to create shared libraries if on.
set(BUILD_SHARED_LIBS ON)
endif()
if(OPUS_STACK_PROTECTOR)
if(NOT MSVC) # GC on by default on MSVC
check_and_set_flag(STACK_PROTECTION_STRONG -fstack-protector-strong)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment