Exclude building googletest and LLVMTestingSupport libraries from the `all` target. If unittests are being built, these libraries will be built as a dependency anyway. If they are not being built, building them makes little sense as they are not installed or used otherwise. This will also make standalone builds of other projects easier, as it makes it possible to include these directories without having to cover them with additional conditions to prevent them from being built unconditionally. Differential Revision: https://reviews.llvm.org/D137035
29 lines
757 B
CMake
29 lines
757 B
CMake
# Do not build unittest libraries automatically, they will be pulled in
|
|
# by unittests if these are built.
|
|
set(EXCLUDE_FROM_ALL ON)
|
|
|
|
add_llvm_library(LLVMTestingSupport
|
|
Annotations.cpp
|
|
Error.cpp
|
|
SupportHelpers.cpp
|
|
|
|
BUILDTREE_ONLY
|
|
|
|
ADDITIONAL_HEADER_DIRS
|
|
${LLVM_MAIN_INCLUDE_DIR}/llvm/Testing/Support
|
|
|
|
LINK_COMPONENTS
|
|
Support
|
|
)
|
|
|
|
target_link_libraries(LLVMTestingSupport PRIVATE llvm_gtest)
|
|
|
|
# This is to avoid the error in gtest-death-test-internal.h
|
|
# (150,16): error: 'Create' overrides a member function but
|
|
# is not marked 'override' [-Werror,-Wsuggest-override]
|
|
# during self-compile on Windows.
|
|
|
|
if (HOST_WINNT AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override")
|
|
endif()
|