title: Integrate CMake subproject with another
body: <p>I've wrote a C++ library <code>MyLib</code> and I'd like to integrate it with another project <code>ExternPro</code>. So in <code>ExternPro</code> I wrote <code>CMakeLists.txt</code> like this:</p>
  
  <pre><code>add_subdirectory(MyLib)
  ADD_EXECUTABLE(test test.cpp)
  include_directories(${MyLib_INCLUDE_DIRS})
  target_link_libraries(test ${MyLib_LIBRARIES})
  </code></pre>
  
  <p>To set variables <code>MyLib_LIBRARIES</code> and <code>MyLib_INCLUDE_DIRS</code> I wrote:</p>
  
  <pre><code>set(MyLib_LIBRARIES ${PROJECT_SOURCE_DIR}/src/MyLib.a CACHE INTERNAL "")
  set(MyLib_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include CACHE INTERNAL "")
  </code></pre>
  
  <p>But something wrong "No rule to make target MyLib/src/MyLib.a, needed by test.  Stop."</p>
  
  <p>So my question is, how should I wrote <code>CMakeLists.txt</code> correctly so <code>cmake</code>  could help me build <code>MyLib</code> first and then take care of dependencies of <code>ExternPro</code>?</p>