<commit_before>cmake_minimum_required(VERSION 3.0)
project(dabcommon CXX)

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Debug CACHE STRING "The build type" FORCE)
endif()

option(WITH_COMMON_TESTS            "Build and run the unit tests." OFF)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")

set(OUTPUT_PREFIX "${CMAKE_BINARY_DIR}/products/${CMAKE_BUILD_TYPE}" CACHE STRING "The build product prefix" FORCE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_PREFIX}/bin" CACHE STRING "The output path for executables" FORCE)

set(CMAKE_CXX_FLAGS "-std=c++11 -pedantic -Wall -Wextra -Werror")

get_directory_property(HAS_PARENT PARENT_DIRECTORY)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  option(WITH_ADDRESS_SANITIZER       "Include address/memory checks." OFF)
  option(WITH_UNDEFINED_SANITIZER     "Include undefined behavior checks." OFF)

  if(WITH_ADDRESS_SANITIZER OR WITH_UNDEFINED_SANITIZER)
    string(APPEND CMAKE_CXX_FLAGS " -fno-omit-frame-pointer")

    set(SANITIZERS "")

    if(WITH_ADDRESS_SANITIZER)
      list(APPEND SANITIZERS "address")
    endif()

    if(WITH_UNDEFINED_SANITIZER)
      list(APPEND SANITIZERS "undefined")
    endif()

    string(REPLACE ";" "," SANITIZERS "${SANITIZERS}")
    string(APPEND CMAKE_CXX_FLAGS " -fsanitize=${SANITIZERS}")
  endif()
endif()

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")

include_directories("include")
include_directories(SYSTEM "third_party/moodycamel")

if(WITH_COMMON_TESTS AND NOT BUILD_DOCUMENTATION_ONLY)
  include(CUTE)
  include_directories(SYSTEM "third_party/cute")
  add_subdirectory(test)
endif()


if(HAS_PARENT)
  get_property(INCLUDES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
  set(DABCOMMON_INCLUDES "${INCLUDES}" PARENT_SCOPE)
endif()

<commit_msg>cmake: default to Release build<commit_after>cmake_minimum_required(VERSION 3.0)
project(dabcommon CXX)

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release CACHE STRING "The build type" FORCE)
endif()

option(WITH_COMMON_TESTS            "Build and run the unit tests." OFF)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")

set(OUTPUT_PREFIX "${CMAKE_BINARY_DIR}/products/${CMAKE_BUILD_TYPE}" CACHE STRING "The build product prefix" FORCE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_PREFIX}/bin" CACHE STRING "The output path for executables" FORCE)

set(CMAKE_CXX_FLAGS "-std=c++11 -pedantic -Wall -Wextra -Werror")

get_directory_property(HAS_PARENT PARENT_DIRECTORY)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  option(WITH_ADDRESS_SANITIZER       "Include address/memory checks." OFF)
  option(WITH_UNDEFINED_SANITIZER     "Include undefined behavior checks." OFF)

  if(WITH_ADDRESS_SANITIZER OR WITH_UNDEFINED_SANITIZER)
    string(APPEND CMAKE_CXX_FLAGS " -fno-omit-frame-pointer")

    set(SANITIZERS "")

    if(WITH_ADDRESS_SANITIZER)
      list(APPEND SANITIZERS "address")
    endif()

    if(WITH_UNDEFINED_SANITIZER)
      list(APPEND SANITIZERS "undefined")
    endif()

    string(REPLACE ";" "," SANITIZERS "${SANITIZERS}")
    string(APPEND CMAKE_CXX_FLAGS " -fsanitize=${SANITIZERS}")
  endif()
endif()

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")

include_directories("include")
include_directories(SYSTEM "third_party/moodycamel")

if(WITH_COMMON_TESTS AND NOT BUILD_DOCUMENTATION_ONLY)
  include(CUTE)
  include_directories(SYSTEM "third_party/cute")
  add_subdirectory(test)
endif()


if(HAS_PARENT)
  get_property(INCLUDES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
  set(DABCOMMON_INCLUDES "${INCLUDES}" PARENT_SCOPE)
endif()


{'fraction_non_alphanumeric': 0.10420032310177706, 'fraction_numerical': 0.0026925148088314485, 'mean_word_length': 6.298624754420432, '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': '6045989', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1361, 'n_words': 244}