summaryrefslogtreecommitdiff
path: root/libunwind/CMakeLists.txt
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2016-08-08 22:55:48 +0000
committerPetr Hosek <phosek@chromium.org>2016-08-08 22:55:48 +0000
commitf87c19db0b7d341c2fae27b2a93d92fafe72f245 (patch)
tree5b2819b4088c398f9b4148273a40155b56a5c850 /libunwind/CMakeLists.txt
parenta97dcccfb06887e3015b169e278e1c79b3aca283 (diff)
Allow building both shared and static library
This change allows building both shared and static version of libunwind in a single build, sharing object files between both versions. Differential Revision: https://reviews.llvm.org/D23233
Diffstat (limited to 'libunwind/CMakeLists.txt')
-rw-r--r--libunwind/CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index ecbdff00b1e..bebf4adb5df 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -104,6 +104,7 @@ option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build mode.
option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON)
+option(LIBUNWIND_ENABLE_STATIC "Build libunwind as a static library." ON)
option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding support." OFF)
option(LIBUNWIND_ENABLE_ARM_WMMX "Enable unwinding support for ARM WMMX registers." OFF)
@@ -111,6 +112,10 @@ set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling."
set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
+if (NOT LIBUNWIND_ENABLE_SHARED AND NOT LIBUNWIND_ENABLE_STATIC)
+ message(FATAL_ERROR "libunwind must be built as either a shared or static library.")
+endif()
+
# Check that we can build with 32 bits if requested.
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
if (LIBUNWIND_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM