Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Added GENERATE_<TARGET> to flatbuffers_generate_headers #7845

Conversation

CedricSchmeits
Copy link
Contributor

The generation of the library interface supplied by this function only works within the same directory as that the target was defined. By adding a custom target named GENERATE_ now also interface files will be generated by making a target dependend on the generate target.

Example:
/CMakeLists.txt
set(MY_INCL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/fbs/my_incl.fbs)
flatbuffers_generate_headers(TARGET my_incl
SCHEMAS ${MY_INCL_SRC})

add_subdirectory(app)

/app/CMakeLists.txt
add_executable(app src/test.cpp)
target_link_libraries(app my_incl)
add_dependencies(app GENERATE_my_incl)

The generation of the library interface supplied by this function only
works within the same directory as that the target was defined. By
adding a custom target named GENERATE_<TARGET> now also interface files
will be generated by making a target dependend on the generate target.

Example:
/CMakeLists.txt
  set(MY_INCL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/fbs/my_incl.fbs)
  flatbuffers_generate_headers(TARGET my_incl
                               SCHEMAS ${MY_INCL_SRC})

  add_subdirectory(app)

/app/CMakeLists.txt
  add_executable(app src/test.cpp)
  target_link_libraries(app my_incl)
  add_dependencies(app GENERATE_my_incl)
@CedricSchmeits CedricSchmeits changed the title Added GENERATE_<TARGET> to flatbuffers_generate_headers [cmake] Added GENERATE_<TARGET> to flatbuffers_generate_headers Mar 1, 2023
@dbaileychess dbaileychess merged commit 79d6abb into google:master Mar 3, 2023
dbaileychess added a commit that referenced this pull request Mar 15, 2023
The generation of the library interface supplied by this function only
works within the same directory as that the target was defined. By
adding a custom target named GENERATE_<TARGET> now also interface files
will be generated by making a target dependend on the generate target.

Example:
/CMakeLists.txt
  set(MY_INCL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/fbs/my_incl.fbs)
  flatbuffers_generate_headers(TARGET my_incl
                               SCHEMAS ${MY_INCL_SRC})

  add_subdirectory(app)

/app/CMakeLists.txt
  add_executable(app src/test.cpp)
  target_link_libraries(app my_incl)
  add_dependencies(app GENERATE_my_incl)

Co-authored-by: Derek Bailey <derekbailey@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants