summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2016-09-27 03:44:09 +0000
committerShoaib Meenai <smeenai@fb.com>2016-09-27 03:44:09 +0000
commita0863319144d468d524c8606e56ebbfb77c2bf71 (patch)
tree59df35be0dcbfcce2e0048a2cca4340faea7a0cb /CMakeLists.txt
parent46eb39a561ce4e4952abcb05378e38f01fd3fac6 (diff)
[libc++abi] Default to DLL annotations on Windows
`__declspec(dllexport)` and `__declspec(dllimport)` should only be used when building libc++abi as a DLL, but that's the more common use case, so default to adding the annotations and add an option to opt out. Similar to r282449, which made the corresponding change for libc++. Differential Revision: https://reviews.llvm.org/D24945 git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@282470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1487b3..a33cf48 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -249,6 +249,15 @@ if (LIBCXXABI_USE_COMPILER_RT)
list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
endif()
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
+ add_definitions(-D_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+endif()
+
append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG -Werror=return-type)
# Get warning flags
@@ -333,7 +342,6 @@ if (LIBCXXABI_HAS_PTHREAD_API)
add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
endif()
-# This is the _ONLY_ place where add_definitions is called.
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()