From 6bfa107f4ef4a5b2c4afaaa55b9c40d5d24c6ce5 Mon Sep 17 00:00:00 2001 From: Kamil Rojewski Date: Thu, 19 Jul 2018 18:40:28 +0200 Subject: [PATCH] Option to NOT force libc++ when building with clang (#4826) * Eclipse ignore * TypeScript support * Prefixing enums * Test results * Merged JS and TS generators * Fixed AppVeyor build problems * Fixed more AppVeyor build problems * Fixed more AppVeyor build problems * Changed TS flag to options struct * Storing options by value * Removed unneeded const * Re-export support for unions * Uint support * Casting bools to numbers for mutation * TS shell tests * Reverted generates js test file to original version * Backing up js tests and properly generating test data * Not importing flatbuffers for TS test generation * Not overwriting generated js for tests * AppVeyor test fixes * Generating the most strict TS code possible * Not returning null when creating vectors * Not returning null from struct contructors * Vector of unions for ts/js * Sanity check for languages * Indentation fix + output test files * Vectors of unions for php * Fixes to union vector handling + tests * Fix for strictPropertyInitialization * Fix for new aligned operator new for gcc >= 7.1 * Not generating imports/ns prefixes with --gen-all * TypeScript docs * Missing imports of enums * Missing TS links * Enabled vector of unions for java, since it seems to work * Added jitpack config * Added obj to vector of unions getter * Removed unneeded accessor * Bumped jdk version in pom.xml * Vector of unions support for c# * Missing TypeScript doc processing * Option to NOT force libc++ when building with clang --- CMakeLists.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffaff111a..0c5605a38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ option(FLATBUFFERS_BUILD_GRPCTEST "Enable the build of grpctest" OFF) option(FLATBUFFERS_BUILD_SHAREDLIB "Enable the build of the flatbuffers shared library" OFF) +option(FLATBUFFERS_LIBCXX_WITH_CLANG "Force libc++ when using Clang" ON) if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS) message(WARNING @@ -139,14 +140,16 @@ elseif(CMAKE_COMPILER_IS_GNUCXX) elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra -Wno-unused-parameter") - if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux") - set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -stdlib=libc++") - endif() - if(NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD" OR - "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")) - set(CMAKE_EXE_LINKER_FLAGS - "${CMAKE_EXE_LINKER_FLAGS} -lc++abi") + if(FLATBUFFERS_LIBCXX_WITH_CLANG) + if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -stdlib=libc++") + endif() + if(NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD" OR + "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -lc++abi") + endif() endif() # Certain platforms such as ARM do not use signed chars by default