From 5c807599c571eed01fa1c92215af9603bacba98f Mon Sep 17 00:00:00 2001 From: LordGrey Date: Mon, 10 Jun 2019 20:41:42 +0200 Subject: [PATCH] Cross-Compile - Separate flatc scenario for native and cross-compiling --- dependencies/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 20a9a6d0..67c54c29 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -41,11 +41,13 @@ else () set(FLATBUFFERS_INCLUDE_DIRS ${FLATBUFFERS_INCLUDE_DIRS} PARENT_SCOPE) # define the flatc executable at the parent scope - #get_property(FLATBUFFERS_FLATC_EXECUTABLE TARGET flatc PROPERTY LOCATION) + get_property(FLATBUFFERS_FLATC_EXECUTABLE TARGET flatc PROPERTY LOCATION) - #Workaround, set flatc comiplier directory hard, as cmake definitions of flatc do not cater for crosscompile correctly. - #Includ of flatc_export.cmake detects that flatc target is defined aand returns before using the definitions written by export - set ( FLATBUFFERS_FLATC_EXECUTABLE "${CMAKE_BINARY_DIR}/../build-x86x64/bin/flatc") + IF ( CMAKE_CROSSCOMPILING ) + #Workaround, set flatc comiplier directory hard, as cmake definitions of flatc do not cater for crosscompile correctly. + #Includ of flatc_export.cmake detects that flatc target is defined aand returns before using the definitions written by export + set ( FLATBUFFERS_FLATC_EXECUTABLE "${CMAKE_BINARY_DIR}/../build-x86x64/bin/flatc") + ENDIF() set(FLATBUFFERS_FLATC_EXECUTABLE ${FLATBUFFERS_FLATC_EXECUTABLE} PARENT_SCOPE)