diff options
| author | Michal Gorny <mgorny@gentoo.org> | 2018-12-21 13:37:30 +0000 |
|---|---|---|
| committer | Michal Gorny <mgorny@gentoo.org> | 2018-12-21 13:37:30 +0000 |
| commit | 1e8e4fc83492116e2856fc0a2ed1f94cc3570667 (patch) | |
| tree | cddf13f54e8376b2176e544ab2f8491c58cdc164 /compiler-rt/cmake/Modules/CompilerRTUtils.cmake | |
| parent | b47bd52a30333e20c564ae72cd7466a0907bc9c5 (diff) | |
| download | bcm5719-llvm-1e8e4fc83492116e2856fc0a2ed1f94cc3570667.tar.gz bcm5719-llvm-1e8e4fc83492116e2856fc0a2ed1f94cc3570667.zip | |
[xray] [tests] Detect and handle missing LLVMTestingSupport gracefully
Add a code to properly test for presence of LLVMTestingSupport library
when performing a stand-alone build, and skip tests requiring it when
it is not present. Since the library is not installed, llvm-config
reported empty --libs for it and the tests failed to link with undefined
references. Skipping the two fdr_* test files is better than failing to
build, and should be good enough until we find a better solution.
NB: both installing LLVMTestingSupport and building it automatically
from within compiler-rt sources are non-trivial. The former due to
dependency on gtest, the latter due to tight integration with LLVM
source tree.
Differential Revision: https://reviews.llvm.org/D55891
llvm-svn: 349899
Diffstat (limited to 'compiler-rt/cmake/Modules/CompilerRTUtils.cmake')
| -rw-r--r-- | compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index c4500328e5c..518a16a9679 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -239,7 +239,7 @@ macro(load_llvm_config) # Detect if we have the LLVMXRay and TestingSupport library installed and # available from llvm-config. execute_process( - COMMAND ${LLVM_CONFIG_PATH} "--ldflags" "--libs" "xray" "testingsupport" + COMMAND ${LLVM_CONFIG_PATH} "--ldflags" "--libs" "xray" RESULT_VARIABLE HAD_ERROR OUTPUT_VARIABLE CONFIG_OUTPUT) if (HAD_ERROR) @@ -254,6 +254,26 @@ macro(load_llvm_config) set(COMPILER_RT_HAS_LLVMXRAY TRUE) endif() + set(COMPILER_RT_HAS_LLVMTESTINGSUPPORT FALSE) + execute_process( + COMMAND ${LLVM_CONFIG_PATH} "--ldflags" "--libs" "testingsupport" + RESULT_VARIABLE HAD_ERROR + OUTPUT_VARIABLE CONFIG_OUTPUT) + if (HAD_ERROR) + message(WARNING "llvm-config finding testingsupport failed with status ${HAD_ERROR}") + else() + string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT}) + list(GET CONFIG_OUTPUT 0 LDFLAGS) + list(GET CONFIG_OUTPUT 1 LIBLIST) + if (LIBLIST STREQUAL "") + message(WARNING "testingsupport library not installed, some tests will be skipped") + else() + set(LLVM_TESTINGSUPPORT_LDFLAGS ${LDFLAGS} CACHE STRING "Linker flags for LLVMTestingSupport library") + set(LLVM_TESTINGSUPPORT_LIBLIST ${LIBLIST} CACHE STRING "Library list for LLVMTestingSupport") + set(COMPILER_RT_HAS_LLVMTESTINGSUPPORT TRUE) + endif() + endif() + # Make use of LLVM CMake modules. # --cmakedir is supported since llvm r291218 (4.0 release) execute_process( |

