title: Building an application with clang with --coverage on windows
body: <p>i'm trying to build a simple cmake application to test the coverage functionality offer by clang in windows (in linux all work ok).</p>
  
  <p>Environment is:
  Clang version in use: 7.0
  And using LLVM toolset with Visual Studio 2017 build tools
  cmake 3.12 with ninja generator</p>
  
  <p>What I'm doing is simple:
  CMakeLists.txt</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
  
  project(test)
  
  add_compile_options(--coverage)
  
  add_executable(${PROJECT_NAME} 
      main.cpp
  )
  </code></pre>
  
  <p>the main.cpp is as simple as it can get:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  int main(int argc, char const *argv[]) {
      std::cout &lt;&lt; "\ndone.\n";
      return 0;
  }
  </code></pre>
  
  <p>using the build tools environments vcvarsall.bat i initialize the environement to run and compile with clang, like that:</p>
  
  <pre><code>mkdir build
  cd build
  cmake -GNinja -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link ..
  cmake --build . 
  </code></pre>
  
  <p>and the following errors hapear:</p>
  
  <pre><code>lld-link.exe: error: undefined symbol: __llvm_profile_runtime
  &gt;&gt;&gt; referenced by src\app\CMakeFiles\app.dir\main.cpp.obj:(__llvm_profile_runtime_user)
  
  
  lld-link.exe: error: undefined symbol: __llvm_profile_register_function
  &gt;&gt;&gt; referenced by src\app\CMakeFiles\app.dir\main.cpp.obj:(__llvm_profile_register_functions)
  &gt;&gt;&gt; referenced by src\app\CMakeFiles\app.dir\main.cpp.obj:(__llvm_profile_register_functions)
  </code></pre>
  
  <p>What i'm doing wrong or what i need to link to?</p>
  
  <p>Thanks</p>
  
  <p><strong>Update:</strong> with Fred input I realized what library I should be linking to, and if I add the following:</p>
  
  <pre><code>link_libraries("C:/Program Files/LLVM/lib/clang/7.0.0/lib/windows/clang_rt.profile-x86_64.lib")
  </code></pre>
  
  <p>everything works... but is this really the solution for my problem?</p>