[libcxx] r291508 - [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 13 20:00:39 PST 2017


This patch causes `execute_process` to dump the standard error if the
command fails. This causes
the llvm-config help message to be printed as part of CMake configuration,
which is ugly and incorrect.

I've already fixed this for libc++, libc++abi, and libunwind trunk, but the
issue still exists in the release branch.

Please test before committing next time.

/Eric

On Mon, Jan 9, 2017 at 4:41 PM, Michal Gorny via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> 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: "
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170113/aaf77e7c/attachment.html>


More information about the cfe-commits mailing list