<commit_before>cmake_minimum_required(VERSION 2.8)

project (libbson)

include(CheckFunctionExists)
include(CheckIncludeFile)
include(TestBigEndian)
include(InstallRequiredSystemLibraries)

set (SOURCE_DIR "${PROJECT_SOURCE_DIR}/")

set (BSON_MAJOR_VERSION 1)
set (BSON_MINOR_VERSION 1)
set (BSON_MICRO_VERSION 7)
set (BSON_PRERELEASE_VERSION dev)
set (BSON_API_VERSION 1.0)
set (BSON_VERSION 1.1.7-dev)

set (CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/COPYING")
set (CPACK_PACKAGE_VERSION_MAJOR ${BSON_MAJOR_VERSION})
set (CPACK_PACKAGE_VERSION_MINOR ${BSON_MINOR_VERSION})

include (CPack)

TEST_BIG_ENDIAN(BSON_BIG_ENDIAN)

# These need proper checks like automake.
set (BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES 0)

#librt needed on linux for clock_gettime
find_library(RT_LIBRARY rt)
if (RT_LIBRARY)
   #set required libraries for CHECK_FUNCTION_EXISTS
   set(CMAKE_REQUIRED_LIBRARIES ${RT_LIBRARY})
endif()

if (MSVC)
   set (BSON_OS 2)
   set (BSON_HAVE_CLOCK_GETTIME 0)
   set (BSON_HAVE_SNPRINTF 0)
   set (BSON_HAVE_STDBOOL_H 0)
   set (BSON_HAVE_STRNLEN 0)
else ()
   find_package (Threads)

   set (BSON_OS 1)
   CHECK_FUNCTION_EXISTS(clock_gettime BSON_HAVE_CLOCK_GETTIME)
   CHECK_FUNCTION_EXISTS(strnlen BSON_HAVE_STRNLEN)
   CHECK_FUNCTION_EXISTS(snprintf BSON_HAVE_SNPRINTF)
   CHECK_INCLUDE_FILE(stdbool.h BSON_HAVE_STDBOOL_H)
endif ()

set (BSON_HAVE_ATOMIC_32_ADD_AND_FETCH 1)
set (BSON_HAVE_ATOMIC_64_ADD_AND_FETCH 1)

if (BSON_BIG_ENDIAN)
   set (BSON_BYTE_ORDER 4321)
else ()
   set (BSON_BYTE_ORDER 1234)
endif ()

configure_file (
   "${SOURCE_DIR}/src/bson/bson-config.h.in"
   "${PROJECT_BINARY_DIR}/src/bson/bson-config.h"
)

configure_file (
   "${SOURCE_DIR}/src/bson/bson-version.h.in"
   "${PROJECT_BINARY_DIR}/src/bson/bson-version.h"
)

configure_file (
   "${PROJECT_SOURCE_DIR}/build/cmake/bson/bson-stdint.h"
   "${PROJECT_BINARY_DIR}/src/bson/bson-stdint.h"
)

include_directories("${PROJECT_BINARY_DIR}/src/bson")
include_directories("${SOURCE_DIR}/src/bson")
include_directories("${SOURCE_DIR}/src")

if (APPLE)
   cmake_policy(SET CMP0042 OLD)
endif()

set (SOURCES
   ${SOURCE_DIR}/src/bson/bcon.c
   ${SOURCE_DIR}/src/bson/bson.c
   ${SOURCE_DIR}/src/bson/bson-atomic.c
   ${SOURCE_DIR}/src/bson/bson-clock.c
   ${SOURCE_DIR}/src/bson/bson-context.c
   ${SOURCE_DIR}/src/bson/bson-error.c
   ${SOURCE_DIR}/src/bson/bson-iso8601.c
   ${SOURCE_DIR}/src/bson/bson-iter.c
   ${SOURCE_DIR}/src/bson/bson-json.c
   ${SOURCE_DIR}/src/bson/bson-keys.c
   ${SOURCE_DIR}/src/bson/bson-md5.c
   ${SOURCE_DIR}/src/bson/bson-memory.c
   ${SOURCE_DIR}/src/bson/bson-oid.c
   ${SOURCE_DIR}/src/bson/bson-reader.c
   ${SOURCE_DIR}/src/bson/bson-string.c
   ${SOURCE_DIR}/src/bson/bson-utf8.c
   ${SOURCE_DIR}/src/bson/bson-value.c
   ${SOURCE_DIR}/src/bson/bson-version.c
   ${SOURCE_DIR}/src/bson/bson-writer.c
   ${SOURCE_DIR}/src/yajl/yajl_alloc.c
   ${SOURCE_DIR}/src/yajl/yajl_buf.c
   ${SOURCE_DIR}/src/yajl/yajl.c
   ${SOURCE_DIR}/src/yajl/yajl_encode.c
   ${SOURCE_DIR}/src/yajl/yajl_gen.c
   ${SOURCE_DIR}/src/yajl/yajl_lex.c
   ${SOURCE_DIR}/src/yajl/yajl_parser.c
   ${SOURCE_DIR}/src/yajl/yajl_tree.c
   ${SOURCE_DIR}/src/yajl/yajl_version.c
)

set (HEADERS
   ${PROJECT_BINARY_DIR}/src/bson/bson-config.h
   ${PROJECT_BINARY_DIR}/src/bson/bson-stdint.h
   ${PROJECT_BINARY_DIR}/src/bson/bson-version.h
   ${SOURCE_DIR}/src/bson/bcon.h<commit_msg>Fix compile error - add missing bson-timegm.c to CMakeLists.txt.<commit_after>cmake_minimum_required(VERSION 2.8)

project (libbson)

include(CheckFunctionExists)
include(CheckIncludeFile)
include(TestBigEndian)
include(InstallRequiredSystemLibraries)

set (SOURCE_DIR "${PROJECT_SOURCE_DIR}/")

set (BSON_MAJOR_VERSION 1)
set (BSON_MINOR_VERSION 1)
set (BSON_MICRO_VERSION 7)
set (BSON_PRERELEASE_VERSION dev)
set (BSON_API_VERSION 1.0)
set (BSON_VERSION 1.1.7-dev)

set (CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/COPYING")
set (CPACK_PACKAGE_VERSION_MAJOR ${BSON_MAJOR_VERSION})
set (CPACK_PACKAGE_VERSION_MINOR ${BSON_MINOR_VERSION})

include (CPack)

TEST_BIG_ENDIAN(BSON_BIG_ENDIAN)

# These need proper checks like automake.
set (BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES 0)

#librt needed on linux for clock_gettime
find_library(RT_LIBRARY rt)
if (RT_LIBRARY)
   #set required libraries for CHECK_FUNCTION_EXISTS
   set(CMAKE_REQUIRED_LIBRARIES ${RT_LIBRARY})
endif()

if (MSVC)
   set (BSON_OS 2)
   set (BSON_HAVE_CLOCK_GETTIME 0)
   set (BSON_HAVE_SNPRINTF 0)
   set (BSON_HAVE_STDBOOL_H 0)
   set (BSON_HAVE_STRNLEN 0)
else ()
   find_package (Threads)

   set (BSON_OS 1)
   CHECK_FUNCTION_EXISTS(clock_gettime BSON_HAVE_CLOCK_GETTIME)
   CHECK_FUNCTION_EXISTS(strnlen BSON_HAVE_STRNLEN)
   CHECK_FUNCTION_EXISTS(snprintf BSON_HAVE_SNPRINTF)
   CHECK_INCLUDE_FILE(stdbool.h BSON_HAVE_STDBOOL_H)
endif ()

set (BSON_HAVE_ATOMIC_32_ADD_AND_FETCH 1)
set (BSON_HAVE_ATOMIC_64_ADD_AND_FETCH 1)

if (BSON_BIG_ENDIAN)
   set (BSON_BYTE_ORDER 4321)
else ()
   set (BSON_BYTE_ORDER 1234)
endif ()

configure_file (
   "${SOURCE_DIR}/src/bson/bson-config.h.in"
   "${PROJECT_BINARY_DIR}/src/bson/bson-config.h"
)

configure_file (
   "${SOURCE_DIR}/src/bson/bson-version.h.in"
   "${PROJECT_BINARY_DIR}/src/bson/bson-version.h"
)

configure_file (
   "${PROJECT_SOURCE_DIR}/build/cmake/bson/bson-stdint.h"
   "${PROJECT_BINARY_DIR}/src/bson/bson-stdint.h"
)

include_directories("${PROJECT_BINARY_DIR}/src/bson")
include_directories("${SOURCE_DIR}/src/bson")
include_directories("${SOURCE_DIR}/src")

if (APPLE)
   cmake_policy(SET CMP0042 OLD)
endif()

set (SOURCES
   ${SOURCE_DIR}/src/bson/bcon.c
   ${SOURCE_DIR}/src/bson/bson.c
   ${SOURCE_DIR}/src/bson/bson-atomic.c
   ${SOURCE_DIR}/src/bson/bson-clock.c
   ${SOURCE_DIR}/src/bson/bson-context.c
   ${SOURCE_DIR}/src/bson/bson-error.c
   ${SOURCE_DIR}/src/bson/bson-iso8601.c
   ${SOURCE_DIR}/src/bson/bson-iter.c
   ${SOURCE_DIR}/src/bson/bson-json.c
   ${SOURCE_DIR}/src/bson/bson-keys.c
   ${SOURCE_DIR}/src/bson/bson-md5.c
   ${SOURCE_DIR}/src/bson/bson-memory.c
   ${SOURCE_DIR}/src/bson/bson-oid.c
   ${SOURCE_DIR}/src/bson/bson-reader.c
   ${SOURCE_DIR}/src/bson/bson-string.c
   ${SOURCE_DIR}/src/bson/bson-timegm.c
   ${SOURCE_DIR}/src/bson/bson-utf8.c
   ${SOURCE_DIR}/src/bson/bson-value.c
   ${SOURCE_DIR}/src/bson/bson-version.c
   ${SOURCE_DIR}/src/bson/bson-writer.c
   ${SOURCE_DIR}/src/yajl/yajl_alloc.c
   ${SOURCE_DIR}/src/yajl/yajl_buf.c
   ${SOURCE_DIR}/src/yajl/yajl.c
   ${SOURCE_DIR}/src/yajl/yajl_encode.c
   ${SOURCE_DIR}/src/yajl/yajl_gen.c
   ${SOURCE_DIR}/src/yajl/yajl_lex.c
   ${SOURCE_DIR}/src/yajl/yajl_parser.c
   ${SOURCE_DIR}/src/yajl/yajl_tree.c
   ${SOURCE_DIR}/src/yajl/yajl_version.c
)

set (HEADERS
   ${PROJECT_BINARY_DIR}/src/bson/bson-config.h
   ${PROJECT_BINARY_DIR}/src/bson/bson-stdint.h
   ${PROJECT_BINARY_DIR}/src/bson/bson-version.h
   ${SOURCE_DIR}/src/bson/bcon.h
{'fraction_non_alphanumeric': 0.13910378047000438, 'fraction_numerical': 0.01196905561231937, 'mean_word_length': 5.015803336259877, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4113204', 'n_tokens_mistral': 3133, 'n_tokens_neox': 3019, 'n_words': 347}