mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 04:40:56 -06:00
By specifying CODEGEN as an argument to add_custom_command the custom command will be added to a codegen build target. The intent is to provide a convenient way for users to get their generated files without having to build the whole project. This can be helpful for code analysis tools which can be useful for IDEs and CI.
12 lines
365 B
CMake
12 lines
365 B
CMake
add_custom_command(
|
|
OUTPUT
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated.h
|
|
COMMAND
|
|
${CMAKE_COMMAND} -E false
|
|
CODEGEN
|
|
)
|
|
|
|
# We don't want codegen to drive parts of the project that are EXCLUDE_FROM_ALL.
|
|
# This tests that foobar is properly excluded from the codegen build.
|
|
add_executable(foobar EXCLUDE_FROM_ALL error.c ${CMAKE_CURRENT_BINARY_DIR}/generated.h)
|