<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 - Visual Studio LLVM toolchain clang-cl --coverage option and linker errors"
   href="https://bugs.llvm.org/show_bug.cgi?id=40877">40877</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Visual Studio LLVM toolchain clang-cl --coverage option and linker errors
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>neumann@imt.uni-luebeck.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>So I played with the --coverage option for clang-cl and found that my test
projects where not linking due to missing symbols.

After a bit of search for the symbols I found out that I need to link against
"clang_rt.profile-x86_64.lib". After doing that linking works fine. The problem
however is that linking to the file requires a full path. In my CMake file the
command looks like: 

<span class="quote">> target_link_libraries(TestObjLib INTERFACE "\$(LLVMInstallDir)\\lib\\clang\\${CMAKE_CXX_COMPILER_VERSION}\\lib\\windows\\clang_rt.profile-x86_64.lib")</span >

Personally I would expect one of the following behaviors

a) --coverage automatically adds "clang_rt.profile-x86_64.lib" to the required
dependencies

or 

b) I have to manually add "clang_rt.profile-x86_64.lib" as a dependency but
only that and not the full path. 
<span class="quote">> target_link_libraries(TestObjLib INTERFACE clang_rt.profile-x86_64.lib)</span >
should be enough
This obviously requires the LLVM toolset in VS to add
\$(LLVMInstallDir)\\lib\\clang\\<CLANG_VERSION_PLACEHOLDER>\\lib\\windows\\ to
the library paths. 

Other minor details:
clang-cl -help does not list the --coverage option</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>