cmake: link to libunwind
authorSergiu Dotenco <sergiu.dotenco@th-nuernberg.de>
Tue, 21 Apr 2015 14:11:25 +0000 (16:11 +0200)
committerSergiu Dotenco <sergiu.dotenco@gmail.com>
Wed, 15 Jul 2015 20:35:01 +0000 (22:35 +0200)
CMakeLists.txt

index cb0b16c..a1978c4 100644 (file)
@@ -104,6 +104,9 @@ check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
 
 check_library_exists (unwind get_static_proc_name "" HAVE_LIB_UNWIND)
 
+find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library")
+mark_as_advanced (UNWIND_LIBRARY)
+
 check_c_source_compiles ("
 #include <stdlib.h>
 static void foo(void) __attribute__ ((unused));
@@ -358,6 +361,10 @@ add_library (glog
   ${GLOG_SRCS}
 )
 
+if (UNWIND_LIBRARY)
+  target_link_libraries (glog PUBLIC ${UNWIND_LIBRARY})
+endif (UNWIND_LIBRARY)
+
 if (WIN32 AND HAVE_SNPRINTF)
   set_property (SOURCE src/windows/port.cc APPEND PROPERTY COMPILE_DEFINITIONS
     HAVE_SNPRINTF)