[CMake] Attaching cmake commands to a custom target

Kaleb Pederson kaleb.pederson at gmail.com
Wed Mar 12 16:23:16 EDT 2008


If I have a custom target, how can I attach a set of cmake commands to
it?  For example, if I have a target:

ADD_CUSTOM_TARGET(
    docs
    COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
    DEPENDS ${PROJECT_SOURCE_DIR}/Doxyfile
    )

And I want to run the following set of cmake commands any time that
target is executed:

FILE(GLOB_RECURSE HEADERS ${SRCDIR}/*.h)
MESSAGE(STATUS "Header files being processed: ${HEADERS}")
...
MESSAGE(STATUS "Done processing...")

Is there a way to bind a set of cmake commands, like the above, to a
specific target?

Thanks.

--Kaleb


More information about the CMake mailing list