From 60cbbb444091e3b13bca920c4e92a720fe930496 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 4 Jul 2018 13:59:25 +0000 Subject: [PATCH] [CMake] Move some variables around This improves consistency by creating a CMake variable for the dsymutil path. The motivation is that for Swift, the dsymutil binary and the lldb binary live in different directories and we need an option to configure this from the build script. llvm-svn: 336272 --- lldb/CMakeLists.txt | 12 +++++++++++- lldb/test/CMakeLists.txt | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index a5e0cae83ea8..1d67a73b73c5 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -88,6 +88,10 @@ option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) if(LLDB_INCLUDE_TESTS) + + set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}") + set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}") + if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang) set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}") else() @@ -100,8 +104,10 @@ if(LLDB_INCLUDE_TESTS) set(LLDB_DEFAULT_TEST_CXX_COMPILER "") endif() + set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing") set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors") set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH "C++ Compiler to use for building LLDB test inferiors") + set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles") if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR ("${LLDB_TEST_CXX_COMPILER}" STREQUAL "")) @@ -130,7 +136,7 @@ if(LLDB_INCLUDE_TESTS) endif() if(NOT LLDB_BUILT_STANDALONE) - list(APPEND LLDB_TEST_DEPS yaml2obj dsymutil) + list(APPEND LLDB_TEST_DEPS yaml2obj) endif() if(TARGET liblldb) @@ -141,6 +147,10 @@ if(LLDB_INCLUDE_TESTS) list(APPEND LLDB_TEST_DEPS clang) endif() + if(TARGET dsymutil) + list(APPEND LLDB_TEST_DEPS dsymutil) + endif() + add_subdirectory(test) add_subdirectory(unittests) add_subdirectory(lit) diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt index 463c147ff6c7..de548f03069e 100644 --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -47,8 +47,8 @@ set(LLDB_TEST_COMMON_ARGS ) list(APPEND LLDB_TEST_COMMON_ARGS - --executable ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX} - --dsymutil ${LLVM_RUNTIME_OUTPUT_INTDIR}/dsymutil${CMAKE_EXECUTABLE_SUFFIX} + --executable ${LLDB_TEST_EXECUTABLE} + --dsymutil ${LLDB_TEST_DSYMUTIL} -C ${LLDB_TEST_C_COMPILER} )