[llvm-bugs] [Bug 36041] New: Headers not consistently exposed for all IDEs

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 22 11:51:58 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36041

            Bug ID: 36041
           Summary: Headers not consistently exposed for all IDEs
           Product: Build scripts
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: cmake
          Assignee: unassignedbugs at nondot.org
          Reporter: aardappel at gmail.com
                CC: llvm-bugs at lists.llvm.org

When CMake is used with an IDE, you typically want your headers added to your
target add_library / add_executable, to allow the IDE's feature to work (e.g.
find all references of a symbol).

There does not appear to be a way in the current CMake files to force this.
Clang has if(MSVC_IDE OR XCODE) in AddClang.cmake that appears to accomplish
this, but AddLLVM.cmake has nothing similar.

Also, there are other IDE's than those two, e.g. QtCreator (which works well
with LLVM as a generic C++ IDE on Linux) uses "CodeBlocks - Unix Makefiles" as
generator. Now unlike VS or XCode, there appears to be no way to detect that
CodeBlocks is being generator for, and CMAKE_GENERATOR will just be equal to
"Unix Makefiles" in this case.

I'd suggest it may be easier to always add all headers to the targets, as that
covers all possible IDEs, but there may be performance implications of that for
non-IDE users?

So far, a quick hack for me was add something like this to
include/llvm/CMakeLists.txt:

file(GLOB_RECURSE LLVM_ALL_HEADERS "*.h")
add_library(all_llvm_headers "${LLVM_MAIN_SRC_DIR}/cmake/dummy.cpp"
            ${LLVM_ALL_HEADERS})

But that most certainly is a bad idea. Not sure what the correct solution is.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180122/7a6776c4/attachment.html>


More information about the llvm-bugs mailing list