diff options
author | KerstinKeller <KerstinKeller@users.noreply.github.com> | 2023-04-26 07:27:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 05:27:14 +0000 |
commit | d6d83c3a9241403f1179df171d87a77b721d09c2 (patch) | |
tree | 32629fa127c5e5eb9e42a09051ee94a4dfa2ded1 | |
parent | aa6848fbf652600593370bf6ab24e61b2092bead (diff) | |
download | flatbuffers-d6d83c3a9241403f1179df171d87a77b721d09c2.tar.gz flatbuffers-d6d83c3a9241403f1179df171d87a77b721d09c2.tar.bz2 flatbuffers-d6d83c3a9241403f1179df171d87a77b721d09c2.zip |
Allow to use functions from `BuildFlatBuffers.cmake` from a flatbuffers installation installed with CMake. (#7912)
Co-authored-by: Derek Bailey <derekbailey@google.com>
-rw-r--r-- | CMake/BuildFlatBuffers.cmake | 9 | ||||
-rw-r--r-- | CMake/flatbuffers-config.cmake | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/CMake/BuildFlatBuffers.cmake b/CMake/BuildFlatBuffers.cmake index 9adba7dc..631e5adf 100644 --- a/CMake/BuildFlatBuffers.cmake +++ b/CMake/BuildFlatBuffers.cmake @@ -59,6 +59,9 @@ function(build_flatbuffers flatbuffers_schemas if(FLATBUFFERS_FLATC_EXECUTABLE) set(FLATC_TARGET "") set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE}) + elseif(TARGET flatbuffers::flatc) + set(FLATC_TARGET flatbuffers::flatc) + set(FLATC flatbuffers::flatc) else() set(FLATC_TARGET flatc) set(FLATC flatc) @@ -211,6 +214,9 @@ function(flatbuffers_generate_headers) if(FLATBUFFERS_FLATC_EXECUTABLE) set(FLATC_TARGET "") set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE}) + elseif(TARGET flatbuffers::flatc) + set(FLATC_TARGET flatbuffers::flatc) + set(FLATC flatbuffers::flatc) else() set(FLATC_TARGET flatc) set(FLATC flatc) @@ -382,6 +388,9 @@ function(flatbuffers_generate_binary_files) if(FLATBUFFERS_FLATC_EXECUTABLE) set(FLATC_TARGET "") set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE}) + elseif(TARGET flatbuffers::flatc) + set(FLATC_TARGET flatbuffers::flatc) + set(FLATC flatbuffers::flatc) else() set(FLATC_TARGET flatc) set(FLATC flatc) diff --git a/CMake/flatbuffers-config.cmake b/CMake/flatbuffers-config.cmake index 592fc79b..0c32c2fe 100644 --- a/CMake/flatbuffers-config.cmake +++ b/CMake/flatbuffers-config.cmake @@ -1,3 +1,4 @@ include("${CMAKE_CURRENT_LIST_DIR}/FlatBuffersTargets.cmake" OPTIONAL) include("${CMAKE_CURRENT_LIST_DIR}/FlatcTargets.cmake" OPTIONAL) include("${CMAKE_CURRENT_LIST_DIR}/FlatBuffersSharedTargets.cmake" OPTIONAL) +include("${CMAKE_CURRENT_LIST_DIR}/BuildFlatBuffers.cmake" OPTIONAL)
\ No newline at end of file |