<commit_before>cmake_minimum_required(VERSION 2.8)
project(xylib C CXX)

option(USE_ZLIB "Handle compressed GZ files - requires Zlib library" ON)
option(DOWNLOAD_ZLIB "Download and build the Zlib library" OFF)
option(USE_BZIP2 "Handle compressed BZ2 files - requires Bzip2 library" ON)
option(GUI "Build xyConvert GUI - requires wxWidgets 3.0+" ON)
option(BUILD_SHARED_LIBS "Build as a shared library" ON)

if(NOT DEFINED LIB_INSTALL_DIR)
  set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()

# if we build static library we likely prefer 3rd-party libraries also static
if(NOT BUILD_SHARED_LIBS)
  set(CMAKE_FIND_LIBRARY_SUFFIXES
      ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
include_directories(${CMAKE_SOURCE_DIR})

find_package(Boost REQUIRED)
message(STATUS "Boost headers in: ${Boost_INCLUDE_DIR}")
include_directories(${Boost_INCLUDE_DIR})
if (BUILD_SHARED_LIBS AND WIN32)
  add_definitions(-DXYLIB_DLL=1)
endif()

if (DOWNLOAD_ZLIB)
  include(ExternalProject)
  set(zlib_install "${CMAKE_INSTALL_PREFIX}")
  ExternalProject_Add(zlib
    URL "http://zlib.net/zlib-1.2.8.tar.gz"
    URL_MD5 44d667c142d7cda120332623eab69f40
    PREFIX zlib
    CMAKE_ARGS -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
               -DCMAKE_INSTALL_PREFIX:PATH=${zlib_install}
               -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
               -DSKIP_INSTALL_FILES=ON)

# the zlib library should be named zlib1.lib not zlib.lib
#    ExternalProject_Add_Step(zlib RenameLib<commit_msg>CMakeLists.txt: turn off BZIP2 by default, avoid new cmake warning<commit_after>cmake_minimum_required(VERSION 2.8)
project(xylib C CXX)

option(USE_ZLIB "Handle compressed GZ files - requires Zlib library" ON)
option(DOWNLOAD_ZLIB "Download and build the Zlib library" OFF)
option(USE_BZIP2 "Handle compressed BZ2 files - requires Bzip2 library" OFF)
option(GUI "Build xyConvert GUI - requires wxWidgets 3.0+" ON)
option(BUILD_SHARED_LIBS "Build as a shared library" ON)

if(NOT DEFINED LIB_INSTALL_DIR)
  set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()

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

# if we build static library we likely prefer 3rd-party libraries also static
if(NOT BUILD_SHARED_LIBS)
  set(CMAKE_FIND_LIBRARY_SUFFIXES
      ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
include_directories(${CMAKE_SOURCE_DIR})

find_package(Boost REQUIRED)
message(STATUS "Boost headers in: ${Boost_INCLUDE_DIR}")
include_directories(${Boost_INCLUDE_DIR})
if (BUILD_SHARED_LIBS AND WIN32)
  add_definitions(-DXYLIB_DLL=1)
endif()

if (DOWNLOAD_ZLIB)
  include(ExternalProject)
  set(zlib_install "${CMAKE_INSTALL_PREFIX}")
  ExternalProject_Add(zlib
    URL "http://zlib.net/zlib-1.2.8.tar.gz"
    URL_MD5 44d667c142d7cda120332623eab69f40
    PREFIX zlib
    CMAKE_ARGS -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
               -DCMAKE_INSTALL_PREFIX:PATH=${zlib_install}
               -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
               -DSKIP_INSTALL_FILES=ON)

# the zlib library should be named zlib1.lib not zlib.lib
#    ExternalProject_Add_Step(zlib RenameLib
{'fraction_non_alphanumeric': 0.08882521489971347, 'fraction_numerical': 0.027061445399554282, 'mean_word_length': 5.559498956158664, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '566105', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1149, 'n_words': 241}