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: unassignedb...@nondot.org
          Reporter: aardap...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to