[libcxx] r291508 - [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Michal Gorny via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 9 15:41:38 PST 2017
Author: mgorny
Date: Mon Jan 9 17:41:38 2017
New Revision: 291508
URL: http://llvm.org/viewvc/llvm-project?rev=291508&view=rev
Log:
[cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.
Modified:
libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=291508&r1=291507&r2=291508&view=diff
==============================================================================
--- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Mon Jan 9 17:41:38 2017
@@ -38,7 +38,18 @@ macro(find_llvm_parts)
set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+
+ # --cmakedir is supported since llvm r291218 (4.0 release)
+ execute_process(
+ COMMAND ${LLVM_CONFIG_PATH} --cmakedir
+ RESULT_VARIABLE HAD_ERROR
+ OUTPUT_VARIABLE CONFIG_OUTPUT)
+ if(NOT HAD_ERROR)
+ string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
+ else()
+ set(LLVM_CMAKE_PATH
+ "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+ endif()
else()
set(LLVM_FOUND OFF)
message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "
More information about the cfe-commits
mailing list