diff --git a/CMake/BuildFlatBuffers.cmake b/CMake/BuildFlatBuffers.cmake index 9adba7dc8..631e5adfb 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 592fc79b6..0c32c2fe2 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