title: CMake dependencies and Dll copies
body: <p>I did wrote some CMake code to transitively get all library dependencies of a given executable target and copy dlls next to it (yes Windows World)</p>
  <p>Then I got an external library that does not support CMake. That have a single implib lets call it a.lib with an a.dll, this library also depends on another dll without any available implib (b.dll)</p>
  <p>So I wrote a aConfig.cmake like this:</p>
  <pre><code>set(a_FOUND TRUE)
  
  add_library(a SHARED IMPORTED)
  set_target_properties(a PROPERTIES
      IMPORTED_LINK_INTERFACE_LANGUAGES &quot;CXX&quot;
      IMPORTED_LOCATION &quot;${a_DIR}/bin/a.dll&quot;
      IMPORTED_IMPLIB &quot;${a_DIR}/lib/a.lib&quot;
  )
  
  add_library(b SHARED IMPORTED)
  set_target_properties(b PROPERTIES
      IMPORTED_LOCATION &quot;${a_DIR}/bin/b.dll&quot;
  )
  
  # to express a dependency without requiring implib at link time
  target_link_library(a PRIVATE b)
  
  </code></pre>
  <p>I end up with this (expected) error</p>
  <pre><code>IMPORTED library can only be used with the INTERFACE keyword of
    target_link_libraries
  </code></pre>
  <p>Then I modified <code>b</code> to become an INTERFACE (It feels strange here):</p>
  <pre><code>add_library(b INTERFACE IMPORTED)
  set_target_properties(b PROPERTIES
      IMPORTED_LOCATION &quot;${a_DIR}/bin/b.dll&quot;
  )
  target_link_library(a INTERFACE b)
  </code></pre>
  <p>with CMake 3.18 my transitive loop does not want to ask for an IMPORTED_LOCATION on an INTERFACE</p>
  <pre><code>  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
    property &quot;IMPORTED_LOCATION&quot; is not allowed.
  </code></pre>
  <p>but with CMake 3.19 it works and do exactly what I am expecting. So I read the Release Note and except this <a href="https://cmake.org/cmake/help/latest/release/3.19.html#other" rel="nofollow noreferrer">statement</a> :</p>
  <pre><code>Interface Libraries may now have source files added via add_library() or target_sources(). Those with sources will be generated as part of the build system.
  </code></pre>
  <p>nothing seems related to this.</p>
  <p>Since I found the CMake 3.18 error, I feel that what I am doing is wrong but I cannot find a better way to express this runtime dependency.</p>
  <p>Does anyone have a better idea on how to express this dependency or does it feels right like this ?</p>