title: CMake: Linking to an imported library with dependencies fails
body: <p>I have a subdirectory with a CMakeLists.txt which should compile a library using make and export the result as an imported library to the parent directory:</p>
  
  <pre><code>set(static_lib ${CMAKE_CURRENT_BINARY_DIR}/lib/mylib.a)
  
  add_custom_command(
      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
      OUTPUT ${static_lib}
      COMMAND make
      COMMAND make install PREFIX=${CMAKE_CURRENT_BINARY_DIR}
  )
  
  add_custom_target(compile_mylib DEPENDS ${static_lib})
  
  add_library(mylib STATIC IMPORTED)
  set_property(TARGET mylib PROPERTY IMPORTED_LOCATION ${static_lib})
  add_dependencies(mylib compile_mylib)
  </code></pre>
  
  <p>The CMakeLists.txt in the parent directory looks like this:</p>
  
  <pre><code>add_subdirectory(deps/mylib)
  add_executable(mybin source.c)
  target_link_libraries(mybin mylib)
  </code></pre>
  
  <p>On OSX this works just fine - but if I compile the same on Ubuntu it seems to ignore the subdirectory's CMakeLists and complains:</p>
  
  <pre><code>/usr/bin/ld.bfd.real: cannot find -lmylib
  </code></pre>
  
  <p>I'm using Clang for compilation.</p>