Skip to content

Commit

Permalink
[CMake] Get libunwind building under LLVM/runtimes
Browse files Browse the repository at this point in the history
The new LLVM runtimes directory requires the same conventions to be
followed across the runtime projects. These changes make libunwind
build under the runtimes subdirectory.

This patch contains the following changes:

* Rename LLVM_CONFIG to LLVM_CONFIG_PATH
* Check if compiler supports C++11 (required by libunwind)

Differential Revision: https://reviews.llvm.org/D26360

llvm-svn: 286308
  • Loading branch information
petrhosek committed Nov 8, 2016
1 parent b9bf1b5 commit 92e7196
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -13,15 +13,17 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)

# Rely on llvm-config.
set(CONFIG_OUTPUT)
find_program(LLVM_CONFIG "llvm-config")
if(NOT LLVM_CONFIG_PATH)
find_program(LLVM_CONFIG_PATH "llvm-config")
endif()
if (DEFINED LLVM_PATH)
set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
elseif (LLVM_CONFIG)
message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
set(CONFIG_COMMAND ${LLVM_CONFIG} "--includedir" "--prefix" "--src-root")
elseif(LLVM_CONFIG_PATH)
message(STATUS "Found LLVM_CONFIG_PATH as ${LLVM_CONFIG_PATH}")
set(CONFIG_COMMAND ${LLVM_CONFIG_PATH} "--includedir" "--prefix" "--src-root")
execute_process(COMMAND ${CONFIG_COMMAND}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE CONFIG_OUTPUT)
5 changes: 5 additions & 0 deletions libunwind/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
@@ -38,6 +38,11 @@ check_cxx_compiler_flag(/EHsc LIBUNWIND_HAS_EHSC_FLAG)
check_cxx_compiler_flag(/EHs- LIBUNWIND_HAS_NO_EHS_FLAG)
check_cxx_compiler_flag(/EHa- LIBUNWIND_HAS_NO_EHA_FLAG)
check_cxx_compiler_flag(/GR- LIBUNWIND_HAS_NO_GR_FLAG)
check_cxx_compiler_flag(-std=c++11 LIBUNWIND_HAS_STD_CXX11)

if(LIBUNWIND_HAS_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

check_library_exists(c fopen "" LIBUNWIND_HAS_C_LIB)
check_library_exists(dl dladdr "" LIBUNWIND_HAS_DL_LIB)

0 comments on commit 92e7196

Please sign in to comment.