Skip to content

Allow to use functions from BuildFlatBuffers.cmake from a flatbuffe…#7912

Merged
dbaileychess merged 2 commits intogoogle:masterfrom
KerstinKeller:cmake-build-flatbuffers-include
Apr 26, 2023
Merged

Allow to use functions from BuildFlatBuffers.cmake from a flatbuffe…#7912
dbaileychess merged 2 commits intogoogle:masterfrom
KerstinKeller:cmake-build-flatbuffers-include

Conversation

@KerstinKeller
Copy link
Copy Markdown
Contributor

…rs installation installed with CMake.

Solves #7909

I tried to build and install flatbuffers (including flatc) with CMake.
When trying to integrate that install into my project, I realized that the very convenient flatbuffers_generate_headers functions could not be used.
This PR fixes that.

(Instead of adding this clause

elseif(TARGET flatbuffers::flatc)
    set(FLATC_TARGET flatbuffers::flatc)
    set(FLATC flatbuffers::flatc)

it would also be possible to create an ALIAS target flatbuffers::flatc (e.g. add_executable(flatbuffers::flatc ALIAS flatc) and reference that throughout the the whole project. Doing the same for the other targets (e.g. flatbuffers::flatbuffers... ) allows the same experience for both consumers who build flatbuffers as part of their build, or use an installed version instead. But this PR goes the easier, quick way to fix the described problem.)

@dbaileychess
Copy link
Copy Markdown
Collaborator

Feel free to do another PR with the alias, as that sounds better.

@dbaileychess dbaileychess enabled auto-merge (squash) April 26, 2023 05:23
@dbaileychess dbaileychess merged commit d6d83c3 into google:master Apr 26, 2023
jochenparm pushed a commit to jochenparm/flatbuffers that referenced this pull request Oct 29, 2024
…rs installation installed with CMake. (google#7912)

Co-authored-by: Derek Bailey <derekbailey@google.com>
jochenparm pushed a commit to jochenparm/flatbuffers that referenced this pull request Oct 29, 2024
…rs installation installed with CMake. (google#7912)

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