<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Headers not consistently exposed for all IDEs"
   href="https://bugs.llvm.org/show_bug.cgi?id=36041">36041</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Headers not consistently exposed for all IDEs
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>cmake
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aardappel@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>