[llvm] r282510 - [CMake] Use if(... IN_LIST ...) instead of list(FIND...)
Chris Bieneman via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 27 16:28:10 PDT 2016
I forced the policy on in r282552. Hopefully that should have you good.
-Chris
> On Sep 27, 2016, at 4:23 PM, Chris Bieneman via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> I didn’t see that on any of the bots, but I’ll force the policy on which should hopefully make the error go away.
>
> -Chris
>
>> On Sep 27, 2016, at 4:19 PM, Hans Wennborg <hans at chromium.org> wrote:
>>
>> Is anyone else getting errors for this? My build fails with:
>>
>> CMake Warning (dev) at cmake/modules/AddLLVM.cmake:779 (if):
>> Policy CMP0057 is not set: Support new IN_LIST if() operator. Run "cmake
>> --help-policy CMP0057" for policy details. Use the cmake_policy command to
>> set the policy and suppress this warning.
>>
>> IN_LIST will be interpreted as an operator when the policy is set to NEW.
>> Since the policy is not set the OLD behavior will be used.
>> Call Stack (most recent call first):
>> tools/llvm-ar/CMakeLists.txt:9 (add_llvm_tool)
>> This warning is for project developers. Use -Wno-dev to suppress it.
>>
>> CMake Error at cmake/modules/AddLLVM.cmake:779 (if):
>> if given arguments:
>>
>> "llvm-ar" "IN_LIST" "LLVM_TOOLCHAIN_TOOLS" "OR" "NOT"
>> "LLVM_INSTALL_TOOLCHAIN_ONLY"
>>
>> Unknown arguments specified
>> Call Stack (most recent call first):
>> tools/llvm-ar/CMakeLists.txt:9 (add_llvm_tool)
>>
>>
>> -- Configuring incomplete, errors occurred!
>>
>> $ cmake --version
>> cmake version 3.5.2
>>
>>
>> All buildbots seem fine, so it's probably something in my config, but
>> maybe someone else has seen this?
>>
>> - Hans
>>
>>
>> On Tue, Sep 27, 2016 at 10:47 AM, Chris Bieneman via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>> Author: cbieneman
>>> Date: Tue Sep 27 12:47:24 2016
>>> New Revision: 282510
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=282510&view=rev
>>> Log:
>>> [CMake] Use if(... IN_LIST ...) instead of list(FIND...)
>>>
>>> NFC. This is just a little code cleanup to make things easier to read and understand.
>>>
>>> Modified:
>>> llvm/trunk/cmake/modules/AddLLVM.cmake
>>>
>>> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=282510&r1=282509&r2=282510&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
>>> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue Sep 27 12:47:24 2016
>>> @@ -776,8 +776,7 @@ macro(add_llvm_tool name)
>>> endif()
>>> add_llvm_executable(${name} ${ARGN})
>>>
>>> - list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL)
>>> - if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
>>> + if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
>>> if( LLVM_BUILD_TOOLS )
>>> install(TARGETS ${name}
>>> EXPORT LLVMExports
>>> @@ -1264,20 +1263,13 @@ function(add_llvm_tool_symlink name dest
>>> add_custom_target(${target_name} ALL DEPENDS ${output_path})
>>> set_target_properties(${target_name} PROPERTIES FOLDER Tools)
>>>
>>> - # Make sure the parent tool is a toolchain tool, otherwise exclude this tool
>>> - list(FIND LLVM_TOOLCHAIN_TOOLS ${dest} LLVM_IS_${dest}_TOOLCHAIN_TOOL)
>>> - if (NOT LLVM_IS_${dest}_TOOLCHAIN_TOOL GREATER -1)
>>> - set(LLVM_IS_${name}_TOOLCHAIN_TOOL ${LLVM_IS_${dest}_TOOLCHAIN_TOOL})
>>> - else()
>>> - list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL)
>>> + # Make sure both the link and target are toolchain tools
>>> + if (NOT ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT ${dest} IN_LIST LLVM_TOOLCHAIN_TOOLS)
>>> + return()
>>> endif()
>>>
>>> - # LLVM_IS_${name}_TOOLCHAIN_TOOL will only be greater than -1 if both this
>>> - # tool and its parent tool are in LLVM_TOOLCHAIN_TOOLS
>>> - if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
>>> - if( LLVM_BUILD_TOOLS )
>>> - llvm_install_symlink(${name} ${dest})
>>> - endif()
>>> + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_TOOLS )
>>> + llvm_install_symlink(${name} ${dest})
>>> endif()
>>> endif()
>>> endfunction()
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list