From eff015538b70adcb9f3976ac8d2181513e28c1c1 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Tue, 12 Dec 2017 01:20:52 +0000 Subject: [CMake] Support runtimes and monorepo layouts when looking for libcxx This also slightly refactors the code that's checking the directory presence which allows eliminating one unnecessary variable. Differential Revision: https://reviews.llvm.org/D40637 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320446 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index e791089fe..4b953b212 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,17 +344,15 @@ endif() add_subdirectory(include) -set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx) -if(EXISTS ${COMPILER_RT_LIBCXX_PATH}/) - set(COMPILER_RT_HAS_LIBCXX_SOURCES TRUE) -else() - set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/../libcxx) - if(EXISTS ${COMPILER_RT_LIBCXX_PATH}/) - set(COMPILER_RT_HAS_LIBCXX_SOURCES TRUE) - else() - set(COMPILER_RT_HAS_LIBCXX_SOURCES FALSE) +foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxx + ${LLVM_MAIN_SRC_DIR}/runtimes/libcxx + ${LLVM_MAIN_SRC_DIR}/../libcxx + ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}) + if(IS_DIRECTORY ${path}) + set(COMPILER_RT_LIBCXX_PATH ${path}) + break() endif() -endif() +endforeach() set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld) if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD) -- cgit v1.2.3