[PATCH] D33059: Create an shared include directory for gtest helper functions

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 14:05:51 PDT 2017


Ok, I'll get that patch upstreamed shortly.  Thanks for the suggested fix!

On Wed, Jun 14, 2017 at 2:02 PM Juergen Ributzka <juergen at ributzka.de>
wrote:

> On Jun 14, 2017, at 1:51 PM, Zachary Turner <zturner at google.com> wrote:
>
> Hopefully you’ll forgive my ignorance, as I only pretend to know CMake,
> but when it gets more involved I need some additional assistance :)
>
>
> I thought I knew CMake too … until I saw the LLVM CMake scripts :-(
>
>
> To dumb this down, are you saying that I need to:
>
> a) Never list TestingSupport in LLVM_LINK_COMPONENTS
> and
>
>
> Yup
>
> b) instead link it with target_link_libraries()?
>
>
> Yup. This is what we currently do for gtest_main and gtest in add_unittest:
>
> llvm/cmake/modules/AddLLVM.cmake:1031: target_link_libraries(${test_name}
> gtest_main gtest ${LLVM_PTHREAD_LIB})
>
>
> And that should fix the problem?
>
>
> Yes, I tired it and it works for my configuration. It seems a little
> hacky, but that is how gtest is handled too.
>
>
> On Wed, Jun 14, 2017 at 1:44 PM Juergen Ributzka <juergen at ributzka.de>
> wrote:
>
>> Hi Zack,
>>
>> this breaks cmake for me when I try to configure a build with NO targets:
>> CMake Error at cmake/modules/LLVM-Config.cmake:31 (list): list
>> sub-command REMOVE_ITEM requires two or more arguments. Call Stack (most
>> recent call first): cmake/modules/LLVM-Config.cmake:256
>> (is_llvm_target_library) cmake/modules/LLVM-Config.cmake:100
>> (llvm_map_components_to_libnames) cmake/modules/LLVM-Config.cmake:93
>> (explicit_llvm_config) cmake/modules/AddLLVM.cmake:714 (llvm_config)
>> cmake/modules/AddLLVM.cmake:1025 (add_llvm_executable)
>> unittests/CMakeLists.txt:5 (add_unittest)
>> unittests/DebugInfo/CodeView/CMakeLists.txt:11 (add_llvm_unittest)
>>
>> TestingSupport is configured with BUILDTREE_ONLY. This prevents it from
>> being added to LLVM_LIBS. This seems intentional and mirrors what
>> gtest_main is doing. The problem is that once you add TestingSupport as a
>> link dependency our current cmake logic fails. It works for test_main,
>> because it is never listed in LLVM_LINK_COMPONENTS and always added as part
>> of add_unittest.
>>
>> Doing the same for TestingSupport would fix the issue.
>>
>> --Juergen
>>
>> On Wed, Jun 14, 2017 at 9:42 AM, Zachary Turner via Phabricator via
>> llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>
>>> This revision was automatically updated to reflect the committed changes.
>>> Closed by commit rL305395: [gtest] Create a shared include directory for
>>> gtest utilities. (authored by zturner).
>>>
>>> Changed prior to commit:
>>>   https://reviews.llvm.org/D33059?vs=102340&id=102563#toc
>>>
>>> Repository:
>>>   rL LLVM
>>>
>>> https://reviews.llvm.org/D33059
>>>
>>> Files:
>>>   llvm/trunk/include/llvm/Testing/Support/Error.h
>>>   llvm/trunk/include/llvm/Testing/Support/SupportHelpers.h
>>>   llvm/trunk/lib/CMakeLists.txt
>>>   llvm/trunk/lib/LLVMBuild.txt
>>>   llvm/trunk/lib/Testing/CMakeLists.txt
>>>   llvm/trunk/lib/Testing/LLVMBuild.txt
>>>   llvm/trunk/lib/Testing/Support/CMakeLists.txt
>>>   llvm/trunk/lib/Testing/Support/Error.cpp
>>>   llvm/trunk/lib/Testing/Support/LLVMBuild.txt
>>>   llvm/trunk/unittests/DebugInfo/CodeView/CMakeLists.txt
>>>   llvm/trunk/unittests/DebugInfo/CodeView/ErrorChecking.h
>>>   llvm/trunk/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp
>>>   llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
>>>   llvm/trunk/unittests/DebugInfo/PDB/CMakeLists.txt
>>>   llvm/trunk/unittests/DebugInfo/PDB/ErrorChecking.h
>>>   llvm/trunk/unittests/DebugInfo/PDB/HashTableTest.cpp
>>>   llvm/trunk/unittests/DebugInfo/PDB/MSFBuilderTest.cpp
>>>   llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
>>>   llvm/trunk/unittests/DebugInfo/PDB/StringTableBuilderTest.cpp
>>>   llvm/trunk/unittests/DebugInfo/PDB/TypeServerHandlerTest.cpp
>>>   llvm/trunk/unittests/Support/BinaryStreamTest.cpp
>>>   llvm/trunk/unittests/Support/CMakeLists.txt
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170614/97b787fb/attachment.html>


More information about the llvm-commits mailing list