summaryrefslogtreecommitdiffstats
path: root/libunwind/src
diff options
context:
space:
mode:
Diffstat (limited to 'libunwind/src')
-rw-r--r--libunwind/src/CMakeLists.txt85
1 files changed, 49 insertions, 36 deletions
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 572c82396bf..0b2a830b2ca 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -5,7 +5,11 @@ set(LIBUNWIND_CXX_SOURCES
Unwind-EHABI.cpp
Unwind-seh.cpp
)
-unwind_append_if(LIBUNWIND_CXX_SOURCES APPLE Unwind_AppleExtras.cpp)
+if(APPLE)
+ list(APPEND LIBUNWIND_CXX_SOURCES
+ Unwind_AppleExtras.cpp
+ )
+endif()
set(LIBUNWIND_C_SOURCES
UnwindLevel1.c
@@ -39,10 +43,11 @@ set(LIBUNWIND_HEADERS
../include/libunwind.h
../include/unwind.h
)
-
-unwind_append_if(LIBUNWIND_HEADERS APPLE
+if(APPLE)
+ list(APPEND LIBUNWIND_HEADERS
../include/mach-o/compact_unwind_encoding.h
)
+endif()
if (MSVC_IDE)
# Force them all into the headers dir on MSVC, otherwise they end up at
@@ -56,32 +61,28 @@ set(LIBUNWIND_SOURCES
${LIBUNWIND_ASM_SOURCES})
# Generate library list.
-set(libraries)
-unwind_append_if(libraries LIBUNWIND_HAS_C_LIB c)
+add_library_flags_if(LIBUNWIND_HAS_C_LIB c)
if (LIBUNWIND_USE_COMPILER_RT)
- list(APPEND libraries "${LIBUNWIND_BUILTINS_LIBRARY}")
+ add_library_flags("${LIBUNWIND_BUILTINS_LIBRARY}")
else()
- unwind_append_if(libraries LIBUNWIND_HAS_GCC_S_LIB gcc_s)
- unwind_append_if(libraries LIBUNWIND_HAS_GCC_LIB gcc)
+ add_library_flags_if(LIBUNWIND_HAS_GCC_S_LIB gcc_s)
+ add_library_flags_if(LIBUNWIND_HAS_GCC_LIB gcc)
endif()
-unwind_append_if(libraries LIBUNWIND_HAS_DL_LIB dl)
+add_library_flags_if(LIBUNWIND_HAS_DL_LIB dl)
if (LIBUNWIND_ENABLE_THREADS)
- unwind_append_if(libraries LIBUNWIND_HAS_PTHREAD_LIB pthread)
- unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_WEAK_PTHREAD_LIB -DLIBUNWIND_USE_WEAK_PTHREAD=1)
+ add_library_flags_if(LIBUNWIND_HAS_PTHREAD_LIB pthread)
+ add_compile_flags_if(LIBUNWIND_WEAK_PTHREAD_LIB -DLIBUNWIND_USE_WEAK_PTHREAD=1)
endif()
# Setup flags.
-unwind_append_if(LIBUNWIND_CXX_FLAGS LIBUNWIND_HAS_NO_RTTI_FLAG -fno-rtti)
-
-unwind_append_if(LIBUNWIND_LINK_FLAGS LIBUNWIND_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
+add_link_flags_if_supported(-nodefaultlibs)
# MINGW_LIBRARIES is defined in config-ix.cmake
-unwind_append_if(libraries MINGW "${MINGW_LIBRARIES}")
+add_library_flags_if(MINGW "${MINGW_LIBRARIES}")
-if (LIBUNWIND_HAS_NO_EXCEPTIONS_FLAG AND LIBUNWIND_HAS_FUNWIND_TABLES)
- list(APPEND LIBUNWIND_COMPILE_FLAGS -fno-exceptions)
- list(APPEND LIBUNWIND_COMPILE_FLAGS -funwind-tables)
-elseif (LIBUNWIND_ENABLE_SHARED)
+if (LIBUNWIND_ENABLE_SHARED AND
+ NOT (LIBUNWIND_SUPPORTS_FNO_EXCEPTIONS_FLAG AND
+ LIBUNWIND_SUPPORTS_FUNWIND_TABLES_FLAG))
message(FATAL_ERROR
"Compiler doesn't support generation of unwind tables if exception "
"support is disabled. Building libunwind DSO with runtime dependency "
@@ -89,15 +90,11 @@ elseif (LIBUNWIND_ENABLE_SHARED)
endif()
if (APPLE)
- list(APPEND LIBUNWIND_COMPILE_FLAGS "-U__STRICT_ANSI__")
- list(APPEND LIBUNWIND_LINK_FLAGS
- "-compatibility_version 1"
- "-install_name /usr/lib/libunwind.1.dylib")
+ add_compile_flags("-U__STRICT_ANSI__")
+ add_link_flags("-compatibility_version 1" "-install_name /usr/lib/libunwind.1.dylib")
if (CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6")
- list(APPEND LIBUNWIND_LINK_FLAGS
- "-current_version ${LIBUNWIND_VERSION}"
- "/usr/lib/libSystem.B.dylib")
+ add_link_flags("-current_version ${LIBUNWIND_VERSION}" "/usr/lib/libSystem.B.dylib")
endif ()
endif ()
@@ -117,14 +114,23 @@ if (LIBUNWIND_ENABLE_SHARED)
if(COMMAND llvm_setup_rpath)
llvm_setup_rpath(unwind_shared)
endif()
- target_link_libraries(unwind_shared PRIVATE ${libraries})
+ target_link_libraries(unwind_shared PRIVATE ${LIBUNWIND_LIBRARIES})
set_target_properties(unwind_shared
PROPERTIES
- COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
- LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}"
- OUTPUT_NAME "unwind"
- VERSION "1.0"
- SOVERSION "1")
+ CXX_STANDARD
+ 11
+ CXX_STANDARD_REQUIRED
+ ON
+ COMPILE_FLAGS
+ "${LIBUNWIND_COMPILE_FLAGS}"
+ LINK_FLAGS
+ "${LIBUNWIND_LINK_FLAGS}"
+ OUTPUT_NAME
+ "unwind"
+ VERSION
+ "1.0"
+ SOVERSION
+ "1")
list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared")
if (LIBUNWIND_INSTALL_SHARED_LIBRARY)
list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared")
@@ -134,12 +140,19 @@ endif()
# Build the static library.
if (LIBUNWIND_ENABLE_STATIC)
add_library(unwind_static STATIC ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
- target_link_libraries(unwind_static PRIVATE ${libraries})
+ target_link_libraries(unwind_static PRIVATE ${LIBUNWIND_LIBRARIES})
set_target_properties(unwind_static
PROPERTIES
- COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
- LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}"
- OUTPUT_NAME "unwind")
+ CXX_STANDARD
+ 11
+ CXX_STANDARD_REQUIRED
+ ON
+ COMPILE_FLAGS
+ "${LIBUNWIND_COMPILE_FLAGS}"
+ LINK_FLAGS
+ "${LIBUNWIND_LINK_FLAGS}"
+ OUTPUT_NAME
+ "unwind")
if(LIBUNWIND_HERMETIC_STATIC_LIBRARY)
append_flags_if_supported(UNWIND_STATIC_LIBRARY_FLAGS -fvisibility=hidden)
OpenPOWER on IntegriCloud