<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - Problem with add_llvm_loadable_module/LLVM_LIBRARY_OUTPUT_INTDIR"
   href="http://llvm.org/bugs/show_bug.cgi?id=18597">18597</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Problem with add_llvm_loadable_module/LLVM_LIBRARY_OUTPUT_INTDIR
          </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>normal
          </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>holt.bg@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Recent changes seem to have broken my ability to build LLVM passes out of
source using CMake.

The problem seems to be with recent commits that introduce
LLVM_RUNTIME_OUTPUT_INTDIR. Specifically, r198205 uses
LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_LIBRARY_OUTPUT_INTDIR (introduced recently
by "NAKAMURA Takumi <<a href="mailto:geek4civic@gmail.com">geek4civic@gmail.com</a>>") in `add_llvm_loadable_module`.
However, these variables are only set in CMakeLists.txt, which means that when
building out of source, they are not available.

What I think needs to happen is these variables need to make their way into
LLVMConfig.cmake.in so that they'll be set when external CMake projects load
LLVM's CMake modules.

The following extremely simple patch fixed the problem for me.

------------------------------------------------
diff --git a/cmake/modules/LLVMConfig.cmake.in
b/cmake/modules/LLVMConfig.cmake.in
index 5e38d82..f1531b4 100644
--- a/cmake/modules/LLVMConfig.cmake.in
+++ b/cmake/modules/LLVMConfig.cmake.in
@@ -14,6 +14,9 @@ set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@)

 set(LLVM_TARGETS_WITH_JIT @LLVM_TARGETS_WITH_JIT@)

+set(LLVM_RUNTIME_OUTPUT_INTDIR @LLVM_RUNTIME_OUTPUT_INTDIR@)
+set(LLVM_LIBRARY_OUTPUT_INTDIR @LLVM_LIBRARY_OUTPUT_INTDIR@)
+
 @all_llvm_lib_deps@

 set(TARGET_TRIPLE "@TARGET_TRIPLE@")
------------------------------------------------</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>