summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Codegen/add-custom-command-depends.cmake
blob: 793ab5f88c0276ec7dae7bb87e02a1894143dc12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
add_custom_target(foobar
  COMMAND ${CMAKE_COMMAND} -E copy
    ${CMAKE_CURRENT_SOURCE_DIR}/generated.h.in
    ${CMAKE_CURRENT_BINARY_DIR}/generated.h
)

add_custom_command(
  OUTPUT generated.hpp
  # This test will fail if DEPENDS isn't accounted for in the codegen build graph
  DEPENDS foobar
  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/generated.h
                                   ${CMAKE_CURRENT_BINARY_DIR}/generated.hpp
  CODEGEN
)

add_custom_target(hpp_creator ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/generated.hpp)