[llvm] r240981 - Fix bug #23967. The gtest and gtest_main targets were exported into the

NAKAMURA Takumi geek4civic at gmail.com
Mon Jul 6 06:21:16 PDT 2015


You broke clang build with installed llvm, aka clang standalone build.
http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc18-DA/builds/389

I have a few options;

  1) Revert yours and rework just to exclude gtest* from "all".
  2) Rework gtestmain not to depend on config.h (to build gtest in
clang build tree from llvm source tree).
  3) Abandon building clang's unittests in clang standalone tree.

I prefer (1).

2015-06-30 3:45 GMT+09:00 Dan Liew <dan at su-root.co.uk>:
> Author: delcypher
> Date: Mon Jun 29 13:45:56 2015
> New Revision: 240981
>
> URL: http://llvm.org/viewvc/llvm-project?rev=240981&view=rev
> Log:
> 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.
>
> Modified:
>     llvm/trunk/cmake/modules/AddLLVM.cmake
>     llvm/trunk/cmake/modules/Makefile
>
> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=240981&r1=240980&r2=240981&view=diff
> ==============================================================================
> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Mon Jun 29 13:45:56 2015
> @@ -503,11 +503,17 @@ macro(add_llvm_library name)
>    else()
>      llvm_add_library(${name} ${ARGN})
>    endif()
> -  set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
> +  # The gtest libraries should not be installed or exported as a target
> +  if ("${name}" STREQUAL gtest OR "${name}" STREQUAL gtest_main)
> +    set(_is_gtest TRUE)
> +  else()
> +    set(_is_gtest FALSE)
> +    set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
> +  endif()
>
>    if( EXCLUDE_FROM_ALL )
>      set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
> -  else()
> +  elseif(NOT _is_gtest)
>      if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO")
>        if(ARG_SHARED OR BUILD_SHARED_LIBS)
>          if(WIN32 OR CYGWIN)
>
> Modified: llvm/trunk/cmake/modules/Makefile
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/Makefile?rev=240981&r1=240980&r2=240981&view=diff
> ==============================================================================
> --- llvm/trunk/cmake/modules/Makefile (original)
> +++ llvm/trunk/cmake/modules/Makefile Mon Jun 29 13:45:56 2015
> @@ -47,6 +47,12 @@ ifeq ($(LLVM_LIBS_TO_EXPORT),Error)
>  $(error llvm-config --libs failed)
>  endif
>
> +# Strip out gtest and gtest_main from LLVM_LIBS_TO_EXPORT, these are not
> +# installed and won't be available from the install tree.
> +# FIXME: If we used llvm-config from the install tree this wouldn't be
> +# necessary.
> +LLVM_LIBS_TO_EXPORT := $(filter-out gtest gtest_main,$(LLVM_LIBS_TO_EXPORT))
> +
>  ifndef LLVM_LIBS_TO_EXPORT
>  $(error LLVM_LIBS_TO_EXPORT cannot be empty)
>  endif
> @@ -88,7 +94,8 @@ $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMCo
>           -e 's/@LLVM_CONFIG_EXPORTS_FILE@/$${LLVM_CMAKE_DIR}\/LLVMExports.cmake/' \
>           -e 's/@all_llvm_lib_deps@//' \
>          && \
> -        grep '^set_property.*LLVMBUILD_LIB_DEPS_' "$(LLVMBuildCMakeFrag)" \
> +        ( grep '^set_property.*LLVMBUILD_LIB_DEPS_' "$(LLVMBuildCMakeFrag)" | \
> +          grep -v LLVMBUILD_LIB_DEPS_gtest ) \
>         ) > $@
>
>  $(PROJ_OBJ_DIR)/LLVMConfigVersion.cmake: LLVMConfigVersion.cmake.in
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list