llvm.org GIT mirror llvm / 40a45a2
Fix bug #23967. The gtest and gtest_main targets were exported into the CMake files and should not be by both build systems and also the targets were also installed by the CMake build system which they should not be. The problem was that - the CMake build of LLVM installs and exports the gtest library targets. We should not being doing this, these are not part of LLVM. - the Autoconf/Makefile build of LLVM still had gtest libraries in the installed LLVMConfig.cmake. These problems would cause problems for an external project because when calling llvm_map_components_to_libnames(XXX all) ${XXX} would to contain LLVM's internal gtest libraries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240981 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Liew 4 years ago
2 changed file(s) with 16 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
502502 else()
503503 llvm_add_library(${name} ${ARGN})
504504 endif()
505 set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
505 # The gtest libraries should not be installed or exported as a target
506 if ("${name}" STREQUAL gtest OR "${name}" STREQUAL gtest_main)
507 set(_is_gtest TRUE)
508 else()
509 set(_is_gtest FALSE)
510 set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
511 endif()
506512
507513 if( EXCLUDE_FROM_ALL )
508514 set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
509 else()
515 elseif(NOT _is_gtest)
510516 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO")
511517 if(ARG_SHARED OR BUILD_SHARED_LIBS)
512518 if(WIN32 OR CYGWIN)
4646 $(error llvm-config --libs failed)
4747 endif
4848
49 # Strip out gtest and gtest_main from LLVM_LIBS_TO_EXPORT, these are not
50 # installed and won't be available from the install tree.
51 # FIXME: If we used llvm-config from the install tree this wouldn't be
52 # necessary.
53 LLVM_LIBS_TO_EXPORT := $(filter-out gtest gtest_main,$(LLVM_LIBS_TO_EXPORT))
54
4955 ifndef LLVM_LIBS_TO_EXPORT
5056 $(error LLVM_LIBS_TO_EXPORT cannot be empty)
5157 endif
8793 -e 's/@LLVM_CONFIG_EXPORTS_FILE@/$${LLVM_CMAKE_DIR}\/LLVMExports.cmake/' \
8894 -e 's/@all_llvm_lib_deps@//' \
8995 && \
90 grep '^set_property.*LLVMBUILD_LIB_DEPS_' "$(LLVMBuildCMakeFrag)" \
96 ( grep '^set_property.*LLVMBUILD_LIB_DEPS_' "$(LLVMBuildCMakeFrag)" | \
97 grep -v LLVMBUILD_LIB_DEPS_gtest ) \
9198 ) > $@
9299
93100 $(PROJ_OBJ_DIR)/LLVMConfigVersion.cmake: LLVMConfigVersion.cmake.in