<commit_before>cmake_minimum_required (VERSION 2.6)

project (Intern)

set (PAGE_SIZE 4096 CACHE STRING "Page size for allocations")
option (MMAP_PAGES "Allocate pages with mmap(2)" OFF)
option (INLINE_UNSIGNED "Inline unsigned integers into the ID" OFF)
option (BUILD_STATIC "Build a static library" OFF)
option (DEBUG "Create a debug build" OFF)

configure_file (config.h.in config.h)

if (BUILD_STATIC)
  set (INTERN_LIB_TYPE STATIC)
else ()
  set (INTERN_LIB_TYPE SHARED)
endif ()

add_library (intern ${INTERN_LIB_TYPE} strings.c block.c optimize.c)

install (TARGETS intern DESTINATION lib)
install (FILES strings.h block.h optimize.h DESTINATION include/intern)

enable_testing()
add_executable (tests tests.c)
target_link_libraries (tests intern)
add_test (tests tests)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS tests)

add_executable (benchmark benchmark.c)
target_link_libraries (benchmark intern)

if (DEBUG)
  set (FLAGS "-O0")
else ()
  set (FLAGS "-O3 -march=native")
endif()

set (CMAKE_C_FLAGS "-std=c99 -Wall -pedantic -g -D_GNU_SOURCE ${FLAGS}")<commit_msg>Improve the CMake directives<commit_after>cmake_minimum_required (VERSION 2.6)
cmake_policy (VERSION 3.0.0)

project (Intern)

set (INTERN_LIB_NAME intern)

set (PAGE_SIZE 4096 CACHE STRING "Page size for allocations")
option (MMAP_PAGES "Allocate pages with mmap(2)" OFF)
option (INLINE_UNSIGNED "Inline unsigned integers into the ID" OFF)
option (BUILD_STATIC "Build a static library" OFF)

configure_file (config.h.in config.h)

if (BUILD_STATIC)
  set (INTERN_LIB_TYPE STATIC)
else ()
  set (INTERN_LIB_TYPE SHARED)
endif ()

set (INTERN_SRC strings.c block.c optimize.c)
set (INTERN_HEADERS strings.h block.h optimize.h)

add_library (${INTERN_LIB_NAME} ${INTERN_LIB_TYPE} ${INTERN_SRC})

install (TARGETS ${INTERN_LIB_NAME} DESTINATION lib)
install (FILES ${INTERN_HEADERS} DESTINATION include/${INTERN_LIB_NAME})

enable_testing()
add_executable (tests tests.c)
target_link_libraries (tests ${INTERN_LIB_NAME})
add_test (tests tests)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose DEPENDS tests)

add_executable (benchmark benchmark.c)
target_link_libraries (benchmark ${INTERN_LIB_NAME})

set (CMAKE_C_FLAGS "-std=c99 -Wall -pedantic -g -D_GNU_SOURCE")
set (CMAKE_C_FLAGS_RELEASE "-O3 -march=native")
{'fraction_non_alphanumeric': 0.1020671834625323, 'fraction_numerical': 0.0103359173126615, 'mean_word_length': 6.421725239616613, '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': '5123918', 'n_tokens_mistral': 860, 'n_tokens_neox': 822, 'n_words': 230}