[compiler-rt] r291504 - [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Michal Gorny via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 15:23:56 PST 2017
Author: mgorny
Date: Mon Jan 9 17:23:56 2017
New Revision: 291504
URL: http://llvm.org/viewvc/llvm-project?rev=291504&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:
compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
Modified: compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake?rev=291504&r1=291503&r2=291504&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake Mon Jan 9 17:23:56 2017
@@ -219,8 +219,18 @@ macro(load_llvm_config)
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
# Make use of LLVM CMake modules.
- file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/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()
+ file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
+ set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+ endif()
+
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
# Get some LLVM variables from LLVMConfig.
include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
More information about the llvm-commits
mailing list