title: Why can't cmake locate C++/C++ABI runtime dependencies?
body: <p>I was trying to write a cmake script to auto install my targets:</p>
  <pre><code>set_target_properties(tiflash PROPERTIES INSTALL_RPATH &quot;$ORIGIN/&quot;)
  install (TARGETS A
           COMPONENT A-release
           DESTINATION &quot;.&quot;
           RUNTIME_DEPENDENCY_SETA-dependency)
  install (RUNTIME_DEPENDENCY_SET A-dependency
           COMPONENT A-release
           DESTINATION &quot;.&quot;
           POST_EXCLUDE_REGEXES &quot;libdl.*&quot; &quot;libc-.*&quot; &quot;libc\\..*&quot; &quot;libgcc_s.*&quot; &quot;librt.*&quot; &quot;libm.*&quot; &quot;ld-.*&quot; &quot;libpthread.*&quot;)
  </code></pre>
  <p>In this case, <code>RUNTIME_DEPENDENCY_SET</code> is supposed to include <code>libc++.so.1</code> and <code>libc++abi.so.1</code> as I was using LLVM toolchain and I wanted to package the runtime libs with my executables.</p>
  <p>CMake did include the expected libs; but it complained that cmake cannot locate <code>libc++.so.1</code> and <code>libc++abi.so.1</code>. (I suppose this was because <code>libc++.so.1</code> and <code>libc++abi.so.1</code> were installed in an unregistered location <code>/usr/local/lib/x86_64-unknown-linux-gnu</code>).</p>
  <p>I can walk around this problem by adding sth like <code>DIRECTORIES /usr/local/lib/x86_64-unknown-linux-gnu</code> to the install function. However, warnings will be issued. The document says:</p>
  <blockquote>
  <p>If it is found in such a directory, a warning is issued, because it means that the file is incomplete (it does not list all of the directories that contain its dependencies)</p>
  </blockquote>
  <p>I am curious what does <code>it does not list all of the directories that contain its dependencies</code> mean here? In what list? Rpaths or something else?</p>
  <p>I tried to put <code>/usr/local/lib/x86_64-unknown-linux-gnu</code> to BUILD_RPATH of my target. It did not work. (I have checked the generated install script, it calls file(GET_RUNTIME_DEPENDENCIES) on the building target; so I suppose install rpath won't affect the results.)</p>
  <p>I also have <code>LD_LIBRARY_PATH</code> and <code>LIBRARY_PATH</code> set in my environment (which contains /usr/local/lib/x86_64-unknown-linux-gnu). And <code>CMAKE_PREFIX_PATH</code> is pointing to <code>/usr/local/</code>.</p>