<commit_before># Ubuntu 14.04 (Trusty)
#cmake_minimum_required (VERSION 2.8.12.2)
# Centos 7
#cmake_minimum_required (VERSION 2.8.11)
cmake_minimum_required (VERSION 2.8)

# Disable build of tests and samples. Due to custom build step
# dependency on flatcc tool, some custom build configurations may
# experience issues, and this option can then help.
option(FLATCC_TEST "enable tests" ON)

# Only active if FLATCC_TEST is active. Used to ensure that C++ users
# can include generatd C source. Old GCC pre 4.7 won't compile C++ test
# project.
option(FLATCC_CXX_TEST "enable C++ tests" ON)

# Conditionally set project languages based on FLATCC_TEST, as C++ is
# only necessary if building the tests.
if (FLATCC_TEST AND FLATCC_CXX_TEST)
    project (FlatCC C CXX)
else()
    project (FlatCC C)
endif()

#
# NOTE: when changing build options, clean the build using on of:
#
#   scripts/cleanall.sh
#   scripts/test.sh
#

# Force use of portable shims such as providing `static_assert`, and
# `stdaligh.h`. Otherwise this option is automatically enabled for some
# known compiler configurations below.
option (FLATCC_PORTABLE
    "include extra headers for compilers that do not support certain C11 features" OFF)

# It is not possible to detect posix_memalign when compiling with
# -std=c11 but aligned_alloc is not always available either.
# This options assumes that posix_memalign is then available.
# Without C11, detection depends on _POSIX_C_SOURCE.
option (FLATCC_GNU_POSIX_MEMALIGN
    "use posix_memalign on gnu systems also when C11 is configured" ON)

# Only build the runtime library - mostly intended in combination with
# FLATCC_INSTALL for cross compiling targets.
option(FLATCC_RTONLY "enable build of runtime library only" OFF)

# Use with or witout FLATCC_RTONLY to enable install targets.
# Libraries are built statically by default, but can CMake's
# cmake -DBUILD_SHARED_LIBS=on can override.
option(FLATCC_INSTALL "enable build of runtime library only" OFF)

# Use with debug build with testing enabled only. Enables generation
# of coverage information during build and run. Adds target "coverage"
# which collects data and makes HTML report in build directory
option(FLATCC_COVERAGE "enable coverage" OFF)

# Affects the flatbuffer verify operation. Normally a verify should just
# quickly reject invalid buffers but for troubleshooting, assertions can
# enabled. This requires rebuilding the runtime library and will likely
# break test cases (those that tests that an invalid buffer is invalid).
option (FLATCC_DEBUG_VERIFY
    "assert on verify failure in runtime lib" OFF)

# Print detailed traces of binary buffer contents when calling verify.
option (FLATCC_TRACE_VERIFY
    "assert on verify failure in runtime lib" OFF)

# Reflection is the compilers ability to generate binary schema output
# (.bfbs files). This requires using generated code from
# `reflection.fbs`. During development it may not be possible to
# compile with reflection enabled because it can become impossible to
# fix broken builds. It may also be disabled simple because it isn't
# needed.
option (FLATCC_REFLECTION
    "generation of binary flatbuffer schema files" ON)

# FLATCC_NATIVE_OPTIM and FLATCC_FAST_DOUBLE affects json parsing,
# especially if the content is pretty printed. But it is plenty
# fast without these settings in most cases. Not recommended.
option (FLATCC_NATIVE_OPTIM
    "use machine native optimizations like SSE 4.2" OFF)

# Fast grisu3 string/floating point conversion still depends on strtod
# for about 1-2% of the conversions in order to produce an exact result.
# By allowing a minor difference in the least significant bits, this
# dependeny can be avoided, and speed improved. Some strtod
# implementations call strlen which is really slow on large JSON
# buffers, and catastrophic on buffers that are not zero-terminated -
# regardless of size. Most platforms have a decent strtod these days.
option (FLATCC_FAST_DOUBLE
    "faster but slightly incorrect floating point parser (json)" OFF)

# -Werror is only set for some compiler versions that are believed to
# to not generate any warnings. If the assumption breaks, disable
# this option if the warning is not significant.
option (FLATCC_ALLOW_WERROR "allow -Werror to be configured" ON)

# Experimental setting - sometimes the code branches on a constant
# expression in order to select the best option for a given type size or
# similar. Sometimes compilers don't like that. If this issue surfaces,
# try using this option.
option (FLATCC_IGNORE_CONST_COND "silence const condition warnings" OFF)

if (FLATCC_RTONLY)
    set(FLATCC_TEST off)
endif()

if (FLATCC_TEST)
    enable_testing()
endif()

if (NOT FLATCC_TEST)
    set(FLATCC_COVERAGE off)
endif()

if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
    set(FLATCC_COVERAGE off)
endif()

if (FLATCC_COVERAGE)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -DNDEBUG")
endif()

if (FLATCC_DEBUG_VERIFY)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFLATCC_DEBUG_VERIFY=1")
endif()

if (FLATCC_TRACE_VERIFY)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFLATCC_TRACE_VERIFY=1")
endif()


if (FLATCC_REFLECTION)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFLATCC_REFLECTION=1")
    file(WRITE ${PROJECT_SOURCE_DIR}/build/reflection_enabled "REFLECTION=1")
    file(REMOVE ${PROJECT_SOURCE_DIR}/build/reflection_disabled)
else()
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFLATCC_REFLECTION=0")
    file(REMOVE ${PROJECT_SOURCE_DIR}/build/reflection_enabled)
    file(WRITE ${PROJECT_SOURCE_DIR}/build/reflection_disabled "REFLECTION=0")
endif()


if (FLATCC_NATIVE_OPTIM)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -DFLATCC_USE_SSE4_2=1")
endif()

if (FLATCC_FAST_DOUBLE)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGRISU3_PARSE_ALLOW_ERROR -DFLATCC_USE_GRISU3=1")
endif()

if (NOT DEFINED FLATCC_INSTALL_LIB)
    set(lib_dir lib)
else()
    set(lib_dir ${FLATCC_INSTALL_LIB})
endif()

# The folder of this directory, as apposed to CMAKE_BINARY_DIR
# which would usually be the build/Release and build/Debug paths
set (dist_dir "${PROJECT_SOURCE_DIR}")
# set (dist_dir "${CMAKE_BINARY_DIR}")

message(STATUS "dist install dir ${dist_dir}")
message(STATUS "lib install dir ${dist_dir}/${lib_dir}")

# Note: for compiling generated C code, warnings of unused functions
# and constants should be turned off - those are plentiful. They are
# silenced for Clang, GCC and MSVC in generated headers.headers.

if (CMAKE_C_COMPILER_ID MATCHES "Clang")
    # Clang or AppleClang
    message(STATUS "Setting Clang compiler options")
    # We don't add -Wstrict-prototypes to gcc because it breaks
    # code by failing on function definitions as well.
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-conversion")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -pedantic -Wall -Wextra")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra")
    # Fix broken C++ alignas - either will do
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPORTABLE_PATCH_CPLUSPLUS_STDALIGN") 
    if (FLATCC_ALLOW_WERROR)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
    endif()
    if (FLATCC_IGNORE_CONST_COND)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-tautological-constant-out-of-range-compare")
    endif()

    # To get assembly output
    # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -save-temps")

elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
    execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
                    OUTPUT_VARIABLE GCC_VERSION)
    if (GCC_VERSION VERSION_LESS 4.7)
        message(STATUS "Setting older GNU C compiler options with FLATCC_PORTABLE")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
        # We need stdalign.h
        set(FLATCC_PORTABLE true)
        # Disable C++ test for old compilers known to break due to
        # missing stdalign.h and incomplete stdint.h which is not a
        # priority to fix in portable library for C++ use case.
        # Note: we test the C compiler version not the C++ compiler
        # version, but that is (hopefully) close enough.
        if (FLATCC_CXX_TEST)
            message(STATUS "Disabling C++ tests for GCC pre 4.7")
            set(FLATCC_CXX_TEST false)
        endif()
    else()
        message(STATUS "Setting GNU C compiler options with c11 and Posix")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -pedantic -Wall -Wextra")
        if (NOT (GCC_VERSION VERSION_LESS 8.0))
            # Disable some GCC checks:
            # (warnings exist since 8.0, but are more aggressive in 9.0)
            #
            # -Wstringop-truncation:
            # GCC 9 warns on truncated strncpy into char arrays in FlatBuffer
            # structs, but these are valid as zero-paddded, not zero terminated.
            #
            # -Wno-format-overflow:
            # GCC 9 warns on mistakenly assumed NULL string when 
            # printing from a required FlatBuffer string field.
            #
            message(STATUS "Disabling GNU C compiler warnings: -Wstringop-truncation -Wno-format-overflow")
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-stringop-truncation -Wno-format-overflow")
        endif()
        if (FLATCC_GNU_POSIX_MEMALIGN)
            # -std=c11 prevents detection of posix_memalign and aligned_alloc might be missing
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPORTABLE_POSIX_MEMALIGN=1")
        endif()
        if (FLATCC_ALLOW_WERROR)
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
        endif()
    endif()
    if (FLATCC_IGNORE_CONST_COND)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-type-limits")
    endif()

    # In gcc 4.8 it is not possible to suppress this warning using
    # #pragma GCC diagnostic ignored "-Wunused-function"
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
    #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-type-limits")

elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel")
    message(STATUS "Setting Intel C compiler options")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -Wextra")
elseif (MSVC) # using STREQUAL here conflicts with string interpretation changes in CMake
    message(STATUS "Setting MSVC C compiler options")
    # -DFLATCC_PORTABLE also required, but set earlier
    # -W3 is the highest warning level that is reasonable.
    # See include/flatcc/portable/pwarnings.h for disabled warnings.
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W3 -D_CRT_SECURE_NO_WARNINGS")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W3 -D_CRT_SECURE_NO_WARNINGS")
    # MSVC 2013 (1800) supports inline variable declations
    # while MSVC 2010 (1600) does not.<commit_msg>Update GCC warnings<commit_after># Ubuntu 14.04 (Trusty)
#cmake_minimum_required (VERSION 2.8.12.2)
# Centos 7
#cmake_minimum_required (VERSION 2.8.11)
cmake_minimum_required (VERSION 2.8)

# Disable build of tests and samples. Due to custom build step
# dependency on flatcc tool, some custom build configurations may
# experience issues, and this option can then help.
option(FLATCC_TEST "enable tests" ON)

# Only active if FLATCC_TEST is active. Used to ensure that C++ users
# can include generatd C source. Old GCC pre 4.7 won't compile C++ test
# project.
option(FLATCC_CXX_TEST "enable C++ tests" ON)

# Conditionally set project languages based on FLATCC_TEST, as C++ is
# only necessary if building the tests.
if (FLATCC_TEST AND FLATCC_CXX_TEST)
    project (FlatCC C CXX)
else()
    project (FlatCC C)
endif()

#
# NOTE: when changing build options, clean the build using on of:
#
#   scripts/cleanall.sh
#   scripts/test.sh
#

# Force use of portable shims such as providing `static_assert`, and
# `stdaligh.h`. Otherwise this option is automatically enabled for some
# known compiler configurations below.
option (FLATCC_PORTABLE
    "include extra headers for compilers that do not support certain C11 features" OFF)

# It is not possible to detect posix_memalign when compiling with
# -std=c11 but aligned_alloc is not always available either.
# This options assumes that posix_memalign is then available.
# Without C11, detection depends on _POSIX_C_SOURCE.
option (FLATCC_GNU_POSIX_MEMALIGN
    "use posix_memalign on gnu systems also when C11 is configured" ON)

# Only build the runtime library - mostly intended in combination with
# FLATCC_INSTALL for cross compiling targets.
option(FLATCC_RTONLY "enable build of runtime library only" OFF)

# Use with or witout FLATCC_RTONLY to enable install targets.
# Libraries are built statically by default, but can CMake's
# cmake -DBUILD_SHARED_LIBS=on can override.
option(FLATCC_INSTALL "enable build of runtime library only" OFF)

# Use with debug build with testing enabled only. Enables generation
# of coverage information during build and run. Adds target "coverage"
# which collects data and makes HTML report in build directory
option(FLATCC_COVERAGE "enable coverage" OFF)

# Affects the flatbuffer verify operation. Normally a verify should just
# quickly reject invalid buffers but for troubleshooting, assertions can
# enabled. This requires rebuilding the runtime library and will likely
# break test cases (those that tests that an invalid buffer is invalid).
option (FLATCC_DEBUG_VERIFY
    "assert on verify failure in runtime lib" OFF)

# Print detailed traces of binary buffer contents when calling verify.
option (FLATCC_TRACE_VERIFY
    "assert on verify failure in runtime lib" OFF)

# Reflection is the compilers ability to generate binary schema output
# (.bfbs files). This requires using generated code from
# `reflection.fbs`. During development it may not be possible to
# compile with reflection enabled because it can become impossible to
# fix broken builds. It may also be disabled simple because it isn't
# needed.
option (FLATCC_REFLECTION
    "generation of binary flatbuffer schema files" ON)

# FLATCC_NATIVE_OPTIM and FLATCC_FAST_DOUBLE affects json parsing,
# especially if the content is pretty printed. But it is plenty
# fast without these settings in most cases. Not recommended.
option (FLATCC_NATIVE_OPTIM
    "use machine native optimizations like SSE 4.2" OFF)

# Fast grisu3 string/floating point conversion still depends on strtod
# for about 1-2% of the conversions in order to produce an exact result.
# By allowing a minor difference in the least significant bits, this
# dependeny can be avoided, and speed improved. Some strtod
# implementations call strlen which is really slow on large JSON
# buffers, and catastrophic on buffers that are not zero-terminated -
# regardless of size. Most platforms have a decent strtod these days.
option (FLATCC_FAST_DOUBLE
    "faster but slightly incorrect floating point parser (json)" OFF)

# -Werror is only set for some compiler versions that are believed to
# to not generate any warnings. If the assumption breaks, disable
# this option if the warning is not significant.
option (FLATCC_ALLOW_WERROR "allow -Werror to be configured" ON)

# Experimental setting - sometimes the code branches on a constant
# expression in order to select the best option for a given type size or
# similar. Sometimes compilers don't like that. If this issue surfaces,
# try using this option.
option (FLATCC_IGNORE_CONST_COND "silence const condition warnings" OFF)

if (FLATCC_RTONLY)
    set(FLATCC_TEST off)
endif()

if (FLATCC_TEST)
    enable_testing()
endif()

if (NOT FLATCC_TEST)
    set(FLATCC_COVERAGE off)
endif()

if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
    set(FLATCC_COVERAGE off)
endif()

if (FLATCC_COVERAGE)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -DNDEBUG")
endif()

if (FLATCC_DEBUG_VERIFY)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFLATCC_DEBUG_VERIFY=1")
endif()

if (FLATCC_TRACE_VERIFY)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFLATCC_TRACE_VERIFY=1")
endif()


if (FLATCC_REFLECTION)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFLATCC_REFLECTION=1")
    file(WRITE ${PROJECT_SOURCE_DIR}/build/reflection_enabled "REFLECTION=1")
    file(REMOVE ${PROJECT_SOURCE_DIR}/build/reflection_disabled)
else()
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFLATCC_REFLECTION=0")
    file(REMOVE ${PROJECT_SOURCE_DIR}/build/reflection_enabled)
    file(WRITE ${PROJECT_SOURCE_DIR}/build/reflection_disabled "REFLECTION=0")
endif()


if (FLATCC_NATIVE_OPTIM)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -DFLATCC_USE_SSE4_2=1")
endif()

if (FLATCC_FAST_DOUBLE)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGRISU3_PARSE_ALLOW_ERROR -DFLATCC_USE_GRISU3=1")
endif()

if (NOT DEFINED FLATCC_INSTALL_LIB)
    set(lib_dir lib)
else()
    set(lib_dir ${FLATCC_INSTALL_LIB})
endif()

# The folder of this directory, as apposed to CMAKE_BINARY_DIR
# which would usually be the build/Release and build/Debug paths
set (dist_dir "${PROJECT_SOURCE_DIR}")
# set (dist_dir "${CMAKE_BINARY_DIR}")

message(STATUS "dist install dir ${dist_dir}")
message(STATUS "lib install dir ${dist_dir}/${lib_dir}")

# Note: for compiling generated C code, warnings of unused functions
# and constants should be turned off - those are plentiful. They are
# silenced for Clang, GCC and MSVC in generated headers.headers.

if (CMAKE_C_COMPILER_ID MATCHES "Clang")
    # Clang or AppleClang
    message(STATUS "Setting Clang compiler options")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-conversion")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -pedantic -Wall -Wextra")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra")
    # Fix broken C++ alignas - either will do
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPORTABLE_PATCH_CPLUSPLUS_STDALIGN") 
    if (FLATCC_ALLOW_WERROR)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
    endif()
    if (FLATCC_IGNORE_CONST_COND)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-tautological-constant-out-of-range-compare")
    endif()

    # To get assembly output
    # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -save-temps")

elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
    execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
                    OUTPUT_VARIABLE GCC_VERSION)
    if (GCC_VERSION VERSION_LESS 4.7)
        message(STATUS "Setting older GNU C compiler options with FLATCC_PORTABLE")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
        # We need stdalign.h
        set(FLATCC_PORTABLE true)
        # Disable C++ test for old compilers known to break due to
        # missing stdalign.h and incomplete stdint.h which is not a
        # priority to fix in portable library for C++ use case.
        # Note: we test the C compiler version not the C++ compiler
        # version, but that is (hopefully) close enough.
        if (FLATCC_CXX_TEST)
            message(STATUS "Disabling C++ tests for GCC pre 4.7")
            set(FLATCC_CXX_TEST false)
        endif()
    else()
        message(STATUS "Setting GNU C compiler options with c11 and Posix")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -pedantic -Wall -Wextra")
        if (NOT (GCC_VERSION VERSION_LESS 8.0))
            # Disable some GCC checks:
            # (warnings exist since 8.0, but are more aggressive in 9.0)
            #
            # -Wstringop-truncation:
            # GCC 9 warns on truncated strncpy into char arrays in FlatBuffer
            # structs, but these are valid as zero-paddded, not zero terminated.
            #
            # -Wno-format-overflow:
            # GCC 9 warns on mistakenly assumed NULL string when 
            # printing from a required FlatBuffer string field.
            #
            message(STATUS "Disabling GNU C compiler warnings: -Wstringop-truncation -Wno-format-overflow")
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-stringop-truncation -Wno-format-overflow")
        endif()
        if (FLATCC_GNU_POSIX_MEMALIGN)
            # -std=c11 prevents detection of posix_memalign and aligned_alloc might be missing
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPORTABLE_POSIX_MEMALIGN=1")
        endif()
        if (FLATCC_ALLOW_WERROR)
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
        endif()
    endif()
    if (FLATCC_IGNORE_CONST_COND)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-type-limits")
    endif()

    # Too aggressive, e.g. main() is not permitted and main with
    # args then yields unused arg warning.
    # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes")

    # In gcc 4.8 it is not possible to suppress this warning using
    # #pragma GCC diagnostic ignored "-Wunused-function"
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
    # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-type-limits")

    if (GCC_VERSION VERSION_LESS 4.8)
        # -Wsign-conversion broken for GCC 4.7 conditional operator
    else()
        # Might be disabled if GCC keeps getting more agressive.
        # Incorrectly warns on explicit char to uint32_t casts.
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-conversion")

        # Too aggressive, warns on `x = x + 1;` or `n = -n;`.
        # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
    endif()

elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel")
    message(STATUS "Setting Intel C compiler options")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -Wextra")
elseif (MSVC) # using STREQUAL here conflicts with string interpretation changes in CMake
    message(STATUS "Setting MSVC C compiler options")
    # -DFLATCC_PORTABLE also required, but set earlier
    # -W3 is the highest warning level that is reasonable.
    # See include/flatcc/portable/pwarnings.h for disabled warnings.
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W3 -D_CRT_SECURE_NO_WARNINGS")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W3 -D_CRT_SECURE_NO_WARNINGS")
    # MSVC 2013 (1800) supports inline variable declations
    # while MSVC 2010 (1600) does not.
{'fraction_non_alphanumeric': 0.08048890900860117, 'fraction_numerical': 0.008374830239927569, 'mean_word_length': 3.969853768278965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3984225', 'n_tokens_mistral': 7380, 'n_tokens_neox': 6859, 'n_words': 2365}