tstellar created this revision. Herald added a subscriber: mgorny. Herald added a project: All. tstellar requested review of this revision. Herald added a project: LLDB.
This fixes the stand-alone build configuration where LLVM_MAIN_SRC_DIR does not exist. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D124314 Files: lldb/CMakeLists.txt lldb/unittests/CMakeLists.txt Index: lldb/unittests/CMakeLists.txt =================================================================== --- lldb/unittests/CMakeLists.txt +++ lldb/unittests/CMakeLists.txt @@ -17,20 +17,6 @@ list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE}) endif () -if (LLDB_BUILT_STANDALONE) - # Build the gtest library needed for unittests, if we have LLVM sources - # handy. - if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest) - add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest) - endif() - # LLVMTestingSupport library is needed for Process/gdb-remote. - if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support - AND NOT TARGET LLVMTestingSupport) - add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support - lib/Testing/Support) - endif() -endif() - function(add_lldb_unittest test_name) cmake_parse_arguments(ARG "" Index: lldb/CMakeLists.txt =================================================================== --- lldb/CMakeLists.txt +++ lldb/CMakeLists.txt @@ -124,10 +124,31 @@ finish_swig_lua("lldb-lua" "${lldb_lua_bindings_dir}" "${lldb_lua_target_dir}") endif() +if (LLDB_BUILT_STANDALONE) + # Build the gtest library needed for unittests, if we have LLVM sources + # handy. + if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest) + add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest) + endif() + # LLVMTestingSupport library is needed for Process/gdb-remote. + if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + AND NOT TARGET LLVMTestingSupport) + add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + lib/Testing/Support) + endif() +endif() + +set(LLDB_INCLUDE_UNITTESTS ON) +if (NOT TARGET llvm_gtest) + set(LLDB_INCLUDE_UNITTESTS OFF) +endif() + option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS}) if(LLDB_INCLUDE_TESTS) add_subdirectory(test) - add_subdirectory(unittests) + if (LLDB_INCLUDE_UNITTESTS) + add_subdirectory(unittests) + endif() add_subdirectory(utils) endif()
Index: lldb/unittests/CMakeLists.txt =================================================================== --- lldb/unittests/CMakeLists.txt +++ lldb/unittests/CMakeLists.txt @@ -17,20 +17,6 @@ list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE}) endif () -if (LLDB_BUILT_STANDALONE) - # Build the gtest library needed for unittests, if we have LLVM sources - # handy. - if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest) - add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest) - endif() - # LLVMTestingSupport library is needed for Process/gdb-remote. - if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support - AND NOT TARGET LLVMTestingSupport) - add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support - lib/Testing/Support) - endif() -endif() - function(add_lldb_unittest test_name) cmake_parse_arguments(ARG "" Index: lldb/CMakeLists.txt =================================================================== --- lldb/CMakeLists.txt +++ lldb/CMakeLists.txt @@ -124,10 +124,31 @@ finish_swig_lua("lldb-lua" "${lldb_lua_bindings_dir}" "${lldb_lua_target_dir}") endif() +if (LLDB_BUILT_STANDALONE) + # Build the gtest library needed for unittests, if we have LLVM sources + # handy. + if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest) + add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest) + endif() + # LLVMTestingSupport library is needed for Process/gdb-remote. + if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + AND NOT TARGET LLVMTestingSupport) + add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + lib/Testing/Support) + endif() +endif() + +set(LLDB_INCLUDE_UNITTESTS ON) +if (NOT TARGET llvm_gtest) + set(LLDB_INCLUDE_UNITTESTS OFF) +endif() + option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS}) if(LLDB_INCLUDE_TESTS) add_subdirectory(test) - add_subdirectory(unittests) + if (LLDB_INCLUDE_UNITTESTS) + add_subdirectory(unittests) + endif() add_subdirectory(utils) endif()
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits