<commit_before>PROJECT(AUTOSEG)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2)
CMAKE_POLICY(VERSION 2.8.2)

IF(CMAKE_COMPILER_2005)
  ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
ENDIF(CMAKE_COMPILER_2005)

set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Install CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
set(CMAKE_HELPER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
include(ExternalProject)
include(${CMAKE_HELPER_DIR}/CMakeBuildMacros.cmake)
include(${CMAKE_HELPER_DIR}/PreventInSourceBuilds.cmake)
include(${CMAKE_HELPER_DIR}/CMakeCommonExternalDefinitions.cmake)

SETIFEMPTY( INSTALL_RUNTIME_DESTINATION bin )
#-----------------------------------------------------------------------------
# Install macro
#-----------------------------------------------------------------------------

macro(COMPILE_EXTERNAL_TOOLS)
  set(options "")
  set(oneValueArgs
    TOOL_PROJECT_NAME
    )
  set(multiValueArgs
    TOOL_NAMES
    )
  CMAKE_PARSE_ARGUMENTS(LOCAL
    "${options}"
    "${oneValueArgs}"
    "${multiValueArgs}"
    ${ARGN}
    )
  foreach( var ${LOCAL_TOOL_NAMES} )
    if( DEFINED StringNames )
      set(StringNames "${StringNames}, ${var}" )
    else()
      set(StringNames "${var}")
    endif()
  endforeach()
  list( LENGTH LOCAL_TOOL_NAMES size )
  if( ${size} GREATER 1 )
    set( IsProjectWithMultipleExecutable TRUE )
  else()
    set( IsProjectWithMultipleExecutable FALSE )
  endif()
  option(COMPILE_EXTERNAL_${LOCAL_TOOL_PROJECT_NAME} "Compile External ${LOCAL_TOOL_PROJECT_NAME} (${StringNames})" ON )
  if( COMPILE_EXTERNAL_${LOCAL_TOOL_PROJECT_NAME} )
    foreach( var ${LOCAL_TOOL_NAMES} )
      if( IsProjectWithMultipleExecutable )
        OPTION(COMPILE_EXTERNAL_${var} "Compile ${var}." ON)
      endif()
      if( COMPILE_EXTERNAL_${var} OR ( NOT IsProjectWithMultipleExecutable AND COMPILE_EXTERNAL_${LOCAL_TOOL_PROJECT_NAME} ) )
        list( APPEND LIST_TOOLS ${var} )
        set( ${var}_INSTALL_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LOCAL_TOOL_PROJECT_NAME}-install )
      endif()
    endforeach()
  else()
    foreach( var ${LOCAL_TOOL_NAMES} )
      list( FIND LIST_TOOLS ${var} pos )
      if( "${pos}" GREATER "1" )
        list( REMOVE_ITEM LIST_TOOLS ${var} )
      endif()
    endforeach()
    if( IsProjectWithMultipleExecutable )
      foreach( var ${LOCAL_TOOL_NAMES})
        unset( COMPILE_EXTERNAL_${var} CACHE )
      endforeach()
    endif()
  endif()
  unset( StringNames )
endmacro()

#-----------------------------------------------------------------------------
# Git protocole option
#-----------------------------------------------------------------------------
option(USE_GIT_PROTOCOL "If behind a firewall turn this off to use http
instead." ON)
set(git_protocol "git")
if(NOT USE_GIT_PROTOCOL)
  set(git_protocol "http")
endif()

set(LOCAL_CMAKE_BUILD_OPTIONS
  -DMAKECOMMAND:STRING=${MAKECOMMAND}
  -DCMAKE_SKIP_RPATH:BOOL=ON
  -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
  -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
  -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
  -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
  -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
  -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
  -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
  -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
  -DBUILD_EXAMPLES:BOOL=OFF
  -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
  -DBUILD_TESTING:BOOL=${BUILD_TESTING}
  -DCMAKE_GENERATOR:STRING=${CMAKE_GENERATOR}
  -DCMAKE_EXTRA_GENERATOR:STRING=${CMAKE_EXTRA_GENERATOR}
  -DDART_TESTING_TIMEOUT:STRING=${DART_TESTING_TIMEOUT}
  -DMEMORYCHECK_COMMAND_OPTIONS:STRING=${MEMORYCHECK_COMMAND_OPTIONS}
  -DMEMORYCHECK_COMMAND:PATH=${MEMORYCHECK_COMMAND}
  -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}
  -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}
  -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
  -DSITE:STRING=${SITE}
  -DBUILDNAME:STRING=${BUILDNAME}
)


#External Projects<commit_msg>ENH: Addition of a default setting for CMAKE_BUILD_TYPE<commit_after>PROJECT(AUTOSEG)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2)
CMAKE_POLICY(VERSION 2.8.2)

IF(CMAKE_COMPILER_2005)
  ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
ENDIF(CMAKE_COMPILER_2005)

set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/Install CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
set(CMAKE_HELPER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
include(ExternalProject)
include(${CMAKE_HELPER_DIR}/CMakeBuildMacros.cmake)
include(${CMAKE_HELPER_DIR}/PreventInSourceBuilds.cmake)
include(${CMAKE_HELPER_DIR}/CMakeCommonExternalDefinitions.cmake)

SETIFEMPTY( INSTALL_RUNTIME_DESTINATION bin )
#-----------------------------------------------------------------------------
# Install macro
#-----------------------------------------------------------------------------

macro(COMPILE_EXTERNAL_TOOLS)
  set(options "")
  set(oneValueArgs
    TOOL_PROJECT_NAME
    )
  set(multiValueArgs
    TOOL_NAMES
    )
  CMAKE_PARSE_ARGUMENTS(LOCAL
    "${options}"
    "${oneValueArgs}"
    "${multiValueArgs}"
    ${ARGN}
    )
  foreach( var ${LOCAL_TOOL_NAMES} )
    if( DEFINED StringNames )
      set(StringNames "${StringNames}, ${var}" )
    else()
      set(StringNames "${var}")
    endif()
  endforeach()
  list( LENGTH LOCAL_TOOL_NAMES size )
  if( ${size} GREATER 1 )
    set( IsProjectWithMultipleExecutable TRUE )
  else()
    set( IsProjectWithMultipleExecutable FALSE )
  endif()
  option(COMPILE_EXTERNAL_${LOCAL_TOOL_PROJECT_NAME} "Compile External ${LOCAL_TOOL_PROJECT_NAME} (${StringNames})" ON )
  if( COMPILE_EXTERNAL_${LOCAL_TOOL_PROJECT_NAME} )
    foreach( var ${LOCAL_TOOL_NAMES} )
      if( IsProjectWithMultipleExecutable )
        OPTION(COMPILE_EXTERNAL_${var} "Compile ${var}." ON)
      endif()
      if( COMPILE_EXTERNAL_${var} OR ( NOT IsProjectWithMultipleExecutable AND COMPILE_EXTERNAL_${LOCAL_TOOL_PROJECT_NAME} ) )
        list( APPEND LIST_TOOLS ${var} )
        set( ${var}_INSTALL_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LOCAL_TOOL_PROJECT_NAME}-install )
      endif()
    endforeach()
  else()
    foreach( var ${LOCAL_TOOL_NAMES} )
      list( FIND LIST_TOOLS ${var} pos )
      if( "${pos}" GREATER "1" )
        list( REMOVE_ITEM LIST_TOOLS ${var} )
      endif()
    endforeach()
    if( IsProjectWithMultipleExecutable )
      foreach( var ${LOCAL_TOOL_NAMES})
        unset( COMPILE_EXTERNAL_${var} CACHE )
      endforeach()
    endif()
  endif()
  unset( StringNames )
endmacro()

#-----------------------------------------------------------------------------
# Git protocole option
#-----------------------------------------------------------------------------
option(USE_GIT_PROTOCOL "If behind a firewall turn this off to use http
instead." ON)
set(git_protocol "git")
if(NOT USE_GIT_PROTOCOL)
  set(git_protocol "http")
endif()

#-----------------------------------------------------------------------------
# Set a default build type if none was specified
#-----------------------------------------------------------------------------

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  message(STATUS "Setting build type to 'Release' as none was specified.")
  set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
  # Set the possible values of build type for cmake-gui
  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

#-----------------------------------------------------------------------------
# Common CMake options
#-----------------------------------------------------------------------------

set(LOCAL_CMAKE_BUILD_OPTIONS
  -DMAKECOMMAND:STRING=${MAKECOMMAND}
  -DCMAKE_SKIP_RPATH:BOOL=ON
  -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
  -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
  -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
  -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
  -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
  -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
  -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
  -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
  -DBUILD_EXAMPLES:BOOL=OFF
  -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
  -DBUILD_TESTING:BOOL=${BUILD_TESTING}
  -DCMAKE_GENERATOR:STRING=${CMAKE_GENERATOR}
  -DCMAKE_EXTRA_GENERATOR:STRING=${CMAKE_EXTRA_GENERATOR}
  -DDART_TESTING_TIMEOUT:STRING=${DART_TESTING_TIMEOUT}
  -DMEMORYCHECK_COMMAND_OPTIONS:STRING=${MEMORYCHECK_COMMAND_OPTIONS}
  -DMEMORYCHECK_COMMAND:PATH=${MEMORYCHECK_COMMAND}
  -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}
  -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}
  -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
  -DSITE:STRING=${SITE}
  -DBUILDNAME:STRING=${BUILDNAME}
)


#External Projects
{'fraction_non_alphanumeric': 0.20122222222222222, 'fraction_numerical': 0.0035555555555555557, 'mean_word_length': 3.2943702290076335, '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': '2041849', 'n_tokens_mistral': 3230, 'n_tokens_neox': 3070, 'n_words': 441}