CMake now accepts external toolchain configuration (#4045)
Resolves #4038
Related to https://github.com/ruslo/hunter/pull/529
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad01c21..29e0218 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,7 +99,10 @@
# source_group(Compiler FILES ${FlatBuffers_Compiler_SRCS})
# source_group(Tests FILES ${FlatBuffers_Tests_SRCS})
-if(APPLE)
+if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
+ # do not apply any global settings if the toolchain
+ # is being configured externally
+elseif(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra")
elseif(CMAKE_COMPILER_IS_GNUCXX)