title: cmake dependencies of custom target
body: <p>I use a python script (gen_instantiations.py) to generate a cpp file (autogen_instantiations.cpp) which is included in another cpp file (foo.cpp)
  So I want CMake to regenerate this file whenever foo.hpp or gen_instantiations.py changes.
  Following instructions from the CMake FAQ, here's what I did</p>
  
  <pre><code>add_custom_command(
    COMMAND "./gen_instantiations.py" 
    OUTPUT "autogen_instantiations.cpp"
    WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" 
    DEPENDS gen_instantiations.py foo.hpp
  )
  add_custom_target(instantiations ALL DEPENDS autogen_instantiations.cpp)
  
  add_library(foo
     foo.cpp  
   )
   add_dependencies(foo instantiations)
  </code></pre>
  
  <p>But this runs runs the script every single time. What am I doing wrong?</p>