Permalink
Browse files

Add CMake rule to find new dependency libunwind

  • Loading branch information...
1 parent ad35fed commit b7aa3cfa16d20c896c29cab2a91ab80ccf6db437 @sgolemon sgolemon committed Aug 14, 2012
Showing with 33 additions and 0 deletions.
  1. +28 −0 CMake/FindLibunwind.cmake
  2. +5 −0 CMake/HPHPFindLibs.cmake
@@ -0,0 +1,28 @@
+#
+# $Id$
+#
+# - Find libunwind
+# Find libunwind
+#
+# LIBUNWIND_INCLUDE_DIR - where to find unwind.h and libunwind.h
+# LIBUNWIND_LIBRARY - List of libraries when using libunwind
+# LIBUNWIND_FOUND - True if libunwind found.
+
+
+if(LIBUNWIND_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(LIBUNWIND_FIND_QUIETLY TRUE)
+endif()
+
+FIND_PATH(LIBUNWIND_INCLUDE_DIR libunwind.h)
+if(NOT EXISTS "${LIBUNWIND_INCLUDE_DIR}/unwind.h")
+ message(FATAL_ERROR "libunwind.h found without matching unwind.h")
+ SET(LIBUNWIND_INCLUDE_DIR "")
+endif()
+
+FIND_LIBRARY(LIBUNWIND_LIBRARY unwind)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUNWIND DEFAULT_MSG LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
@@ -28,6 +28,11 @@ endif()
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
+# unwind checks
+find_package(Libunwind REQUIRED)
+include_directories(${LIBUNWIND_INCLUDE_DIR})
+
+# iconv checks
find_package(Libiconv REQUIRED)
include_directories(${LIBICONV_INCLUDE_DIR})
if (LIBICONV_CONST)

0 comments on commit b7aa3cf

Please sign in to comment.