mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 13:56:10 +00:00
Allow builds on platforms with unsigned chars by default
Certain architectures, such as ARM, use unsigned chars by default so require the `-fsigned-char` for certain value comparisons to make sense and in order to compile.
This commit is contained in:
@@ -86,6 +86,12 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
set(CMAKE_CXX_FLAGS
|
set(CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} -Wunused-result -Werror=unused-result")
|
"${CMAKE_CXX_FLAGS} -Wunused-result -Werror=unused-result")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Certain platforms such as ARM do not use signed chars by default
|
||||||
|
# which causes issues with certain bounds checks.
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -fsigned-char")
|
||||||
|
|
||||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
set(CMAKE_CXX_FLAGS
|
set(CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++ -Wall -pedantic -Werror -Wextra")
|
"${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++ -Wall -pedantic -Werror -Wextra")
|
||||||
@@ -93,6 +99,12 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS
|
set(CMAKE_EXE_LINKER_FLAGS
|
||||||
"${CMAKE_EXE_LINKER_FLAGS} -lc++abi")
|
"${CMAKE_EXE_LINKER_FLAGS} -lc++abi")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Certain platforms such as ARM do not use signed chars by default
|
||||||
|
# which causes issues with certain bounds checks.
|
||||||
|
set(CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -fsigned-char")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FLATBUFFERS_CODE_COVERAGE)
|
if(FLATBUFFERS_CODE_COVERAGE)
|
||||||
|
|||||||
Reference in New Issue
Block a user