title: CMake: Depending on another project
body: <p>I am quite new to CMake and want to achieve a very "common" task with it. Until now, I simply used Eclipse CDT with auto generated makefiles. Suppose I have two projects A and B. A builds a static library and B needs this library. Of course, when building B, I want to ensure that the static library built by A is up-to-date. Thus, a building of project B should trigger the building of A if any changes were made in the sources of A. This is the default behaviour of Eclipse when simply inserting A as a dependency of B.</p>
  
  <p>So, what is the easiest way to achieve this with CMake? I have read some tutorials and similar questions, but none gave me a satisfying answer. </p>
  
  <p>For example, there is the <a href="http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets" rel="nofollow">http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets</a> tutorial which could be a solution. However, it seems quite complex for such an easy task. I have to "install" the targets of A, but I do not want to install anything, I just want B to depend on A. Next, I heard about ExternalProject_add but I don't know how to handle it either.</p>