Commit afa77d5d authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

fix CMake build to link to libunwind correctly again

Summary:
D7642870 accidentally broke linking of folly when libunwind is available.
It change the code to use the contents of `${FOLLY_LINK_LIBRARIES}` in
folly-deps.cmake, but libunwind was added to `${FOLLY_LINK_LIBRARIES}` after
folly-deps.cmake was included, in FollyConfigChecks.cmake.

This moves the check for libunwind to folly-deps.cmake to fix this issue.  All
of the other checks for external libraries are already in folly-deps.cmake.

Reviewed By: yfeldblum

Differential Revision: D7764762

fbshipit-source-id: 922459a7eefcbd92d3d77c02e9c215bb1a5467cc
parent 708e7e70
......@@ -223,16 +223,3 @@ if (FOLLY_HAVE_LIBGFLAGS)
set(FOLLY_GFLAGS_NAMESPACE google)
endif()
endif()
set(FOLLY_USE_SYMBOLIZER OFF)
CHECK_INCLUDE_FILE_CXX(elf.h FOLLY_HAVE_ELF_H)
find_library(UNWIND_LIBRARIES NAMES unwind)
if (UNWIND_LIBRARIES)
list(APPEND FOLLY_LINK_LIBRARIES ${UNWIND_LIBRARIES})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${UNWIND_LIBRARIES})
endif()
check_function_exists(backtrace FOLLY_HAVE_BACKTRACE)
if (FOLLY_HAVE_ELF_H AND FOLLY_HAVE_BACKTRACE AND LIBDWARF_FOUND)
set(FOLLY_USE_SYMBOLIZER ON)
endif()
message(STATUS "Setting FOLLY_USE_SYMBOLIZER: ${FOLLY_USE_SYMBOLIZER}")
......@@ -145,6 +145,19 @@ list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBURCU_INCLUDE_DIRS})
list(APPEND FOLLY_LINK_LIBRARIES ${CMAKE_DL_LIBS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
set(FOLLY_USE_SYMBOLIZER OFF)
CHECK_INCLUDE_FILE_CXX(elf.h FOLLY_HAVE_ELF_H)
find_library(UNWIND_LIBRARIES NAMES unwind)
if (UNWIND_LIBRARIES)
list(APPEND FOLLY_LINK_LIBRARIES ${UNWIND_LIBRARIES})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${UNWIND_LIBRARIES})
endif()
check_function_exists(backtrace FOLLY_HAVE_BACKTRACE)
if (FOLLY_HAVE_ELF_H AND FOLLY_HAVE_BACKTRACE AND LIBDWARF_FOUND)
set(FOLLY_USE_SYMBOLIZER ON)
endif()
message(STATUS "Setting FOLLY_USE_SYMBOLIZER: ${FOLLY_USE_SYMBOLIZER}")
add_library(folly_deps INTERFACE)
target_include_directories(folly_deps INTERFACE ${FOLLY_INCLUDE_DIRECTORIES})
target_link_libraries(folly_deps INTERFACE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment