Kuba Ober
2014-Mar-14 23:02 UTC
[LLVMdev] compiler-rt's append_if definition breaks lldb build
In cmake projects, it seems that the scope of macros/functions is global. Whichever definition is seen last, wins. The incompatible assign_if definition in cmake/Modules/CompilerRTUtils.cmake breaks the lldb project, since it so happens that lldb’s CMakeLists are processed after compiler_rt. * In compiler-rt, it’s expected that append_if operates on semicolon delimited strings, also known as cmake lists. * In core llvm, and in lldb, it’s expected that append_if operates on space-delmited strings. I propose to rename those macros/functions to list_append_if etc. If this is agreeable, I’ll prepare a patch. I dislike the “obvious” quick hack of moving the projects *after* tools in the main CMakeLists.txt. I think it must be a matter of policy to treat the cmake function/macro namespace as global across the entire project. I’m willing to write a script to check for this, so that people reviewing patches could sanity-check without undue manual labor. Cheers, Kuba Ober
Will Mitchell
2014-Mar-18 20:33 UTC
[LLVMdev] [lldb-dev] compiler-rt's append_if definition breaks lldb build
On Fri, Mar 14, 2014 at 5:02 PM, Kuba Ober <kuba at mareimbrium.org> wrote:> In cmake projects, it seems that the scope of macros/functions is global. > Whichever definition is seen last, wins. > > The incompatible assign_if definition in > cmake/Modules/CompilerRTUtils.cmake > breaks the lldb project, since it so happens that lldb's CMakeLists are > processed > after compiler_rt. >For reference, this was broken by r203773. The problem Kuba describes is still present. Until a better fix is in place, anyone else seeing this problem (which should trigger anytime you build llvm, compiler_rt, and lldb together via cmake) can work around it with this hack: diff --git a/CMakeLists.txt b/CMakeLists.txt index cf27ead..59ba634 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,8 +129,9 @@ endif() # Disable GCC warnings check_cxx_compiler_flag("-Wno-deprecated-declarations" CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS) -append_if(CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS - "-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) +if (CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +endif() # Disable Clang warnings check_cxx_compiler_flag("-Wno-deprecated-register" Will -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140318/6a67330a/attachment.html>