Aaron Turner wrote:
Whoops, my bad.  Typed "add_custom_target" not "add_custom_command".

Thanks everyone, this makes sense now.

To answer the original question, the best way to generate a bunch of things
only when the users asks is to use add_custom_command to create the rules
and then associate them with a top-level target using add_custom_target:

  add_custom_command(
    OUTPUT myfile.txt
    COMMAND ... # command to generate myfile.txt here
    DEPENDS ... # file-level depends here
    )

  add_custom_target(test_standard DEPENDS myfile.txt)

When add_custom_target is not given the ALL option, it will not build unless
the user explicitly requests it with "make test_standard".  Then the custom
commands it drives will still have normal dependencies to only rebuild when
necessary.

-Brad
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to