Index: lldb/trunk/CMakeLists.txt =================================================================== --- lldb/trunk/CMakeLists.txt +++ lldb/trunk/CMakeLists.txt @@ -62,6 +62,22 @@ option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS}) if(LLDB_INCLUDE_TESTS) + if (TARGET clang) + set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}") + set(LLDB_DEFAULT_TEST_CXX_COMPILER "${LLVM_BINARY_DIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}") + else() + set(LLDB_DEFAULT_TEST_C_COMPILER "") + set(LLDB_DEFAULT_TEST_CXX_COMPILER "") + endif() + + 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") + + if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR + ("${LLDB_TEST_CXX_COMPILER}" STREQUAL "")) + message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run") + endif() + add_subdirectory(test) add_subdirectory(unittests) add_subdirectory(lit) Index: lldb/trunk/lit/CMakeLists.txt =================================================================== --- lldb/trunk/lit/CMakeLists.txt +++ lldb/trunk/lit/CMakeLists.txt @@ -11,10 +11,6 @@ set(ENABLE_SHARED 0) endif(BUILD_SHARED_LIBS) -option(LLDB_TEST_CLANG "Use in-tree clang when testing lldb" Off) -set(LLDB_TEST_C_COMPILER "" CACHE STRING "C compiler to use when testing LLDB") -set(LLDB_TEST_CXX_COMPILER "" CACHE STRING "C++ compiler to use when testing LLDB") - configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) @@ -41,10 +37,7 @@ list(APPEND LLDB_TEST_DEPS debugserver) endif() -if(LLDB_TEST_CLANG) - if(LLDB_TEST_C_COMPILER OR LLDB_TEST_CXX_COMPILER) - message(SEND_ERROR "Cannot override LLDB_TEST__COMPILER and set LLDB_TEST_CLANG.") - endif() +if(TARGET clang) list(APPEND LLDB_TEST_DEPS clang) endif() Index: lldb/trunk/lit/lit.site.cfg.in =================================================================== --- lldb/trunk/lit/lit.site.cfg.in +++ lldb/trunk/lit/lit.site.cfg.in @@ -10,22 +10,8 @@ config.lldb_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@" config.target_triple = "@TARGET_TRIPLE@" config.python_executable = "@PYTHON_EXECUTABLE@" -config.cc = "@CMAKE_C_COMPILER@" -config.cxx = "@CMAKE_CXX_COMPILER@" - -test_c_compiler = "@LLDB_TEST_C_COMPILER@" -test_cxx_compiler = "@LLDB_TEST_CXX_COMPILER@" -test_clang = "@LLDB_TEST_CLANG@".lower() -test_clang = test_clang == "on" or test_clang == "true" or test_clang == "1" - -if len(test_c_compiler) > 0: - config.cc = test_c_compiler -if len(test_c_compiler) > 0: - config.cxx = test_cxx_compiler - -if test_clang: - config.cc = 'clang' - config.cxx = 'clang++' +config.cc = "@LLDB_TEST_C_COMPILER@" +config.cxx = "@LLDB_TEST_CXX_COMPILER@" # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. Index: lldb/trunk/test/CMakeLists.txt =================================================================== --- lldb/trunk/test/CMakeLists.txt +++ lldb/trunk/test/CMakeLists.txt @@ -27,10 +27,6 @@ list(APPEND LLDB_TEST_DEPS lldb-mi) endif() -if ("${LLDB_TEST_COMPILER}" STREQUAL "") - string(REGEX REPLACE ".*ccache\ +" "" LLDB_TEST_COMPILER ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}) -endif() - # The default architecture with which to compile test executables is the default LLVM target # architecture, which itself defaults to the host architecture. string(TOLOWER "${LLVM_TARGET_ARCH}" LLDB_DEFAULT_TEST_ARCH) @@ -43,10 +39,6 @@ ${LLDB_DEFAULT_TEST_ARCH} CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64). Determines whether tests are compiled with -m32 or -m64") -if(LLDB_TEST_CLANG) - set(LLDB_TEST_COMPILER $) -endif() - # Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script set(LLDB_TEST_USER_ARGS "" @@ -60,7 +52,7 @@ -S nm -u CXXFLAGS -u CFLAGS - -C ${LLDB_TEST_COMPILER} + -C ${LLDB_TEST_C_COMPILER} ) if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )