<commit_before>#
# File:
#      CMakeLists.txt
#
# Description:
#      Build the Zipios++ library, tools, packages, tests, documentation.
#
# Documentation:
#      See the CMake documentation.
#
# License:
#      Zipios++ - a small C++ library that provides easy access to .zip files.
#      Copyright (C) 2000-2007  <NAME>
#      Copyright (C) 2015  Made to Order Software Corporation
#
#      This library is free software; you can redistribute it and/or
#      modify it under the terms of the GNU Lesser General Public
#      License as published by the Free Software Foundation; either
#      version 2.1 of the License, or (at your option) any later version.
#
#      This library is distributed in the hope that it will be useful,
#      but WITHOUT ANY WARRANTY; without even the implied warranty of
#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#      Lesser General Public License for more details.
#
#      You should have received a copy of the GNU Lesser General Public
#      License along with this library; if not, write to the Free Software
#      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#

cmake_minimum_required(VERSION 2.8.4)

project( zipios_project )

set( ZIPIOS_VERSION_MAJOR 2 )
set( ZIPIOS_VERSION_MINOR 1 )
set( ZIPIOS_VERSION_PATCH 1 )

set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" )

# SUNOS is not set by cmake
string( REGEX MATCH "SunOS" SUNOS ${CMAKE_SYSTEM_NAME} )

if(CMAKE_COMPILER_IS_GNU_CXX)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -fdiagnostics-show-option -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Winit-self -Wlogical-op -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=4 -Wundef -Wno-unused -Wunused-variable -Wno-variadic-macros -Wno-parentheses -Wno-unknown-pragmas -Wwrite-strings -Wswitch -Wunused-parameter -Wfloat-equal -Wold-style-cast -Wnoexcept" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3" )

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fwrapv" )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror -Wall -Wextra -Wunused-parameter" )
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3" )

if( CYGWIN )
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11" )
else()
    set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC" )
endif()
endif()

if(MSVC)
    set( CMAKE_CXX_FLAGS "-EHsc -DNOMINMAX" )
endif()

option(BUILD_SHARED_LIBS "Build the ${PROJECT_NAME} libraries shared." ON)

if(BUILD_SHARED_LIBS)
    set(ZIPIOS_LIBRARY_TYPE SHARED)
else(BUILD_SHARED_LIBS)
    set(ZIPIOS_LIBRARY_TYPE STATIC)
endif(BUILD_SHARED_LIBS)

option(BUILD_DOCUMENTATION "Build the ${PROJECT_NAME} documentation." ON)

# To generate coverage, use -D<project name>_COVERAGE=ON
#                       and -DCMAKE_BUILD_TYPE=Debug
option( ${PROJECT_NAME}_COVERAGE "Turn on coverage for ${PROJECT_NAME}." OFF )

if( ${${PROJECT_NAME}_COVERAGE} )
    message("*** COVERAGE TURNED ON ***")
    find_program( COV gcov )
    if( ${COV} STREQUAL "COV-NOTFOUND" )
        message( FATAL_ERROR "Coverage requested, but gcov not installed!" )
    endif()
    if( NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
        message( FATAL_ERROR "Coverage requested, but Debug is not turned on! (i.e. -DCMAKE_BUILD_TYPE=Debug)" )
    endif()
    #
    set( COV_C_FLAGS             "-fprofile-arcs -ftest-coverage" )
    set( COV_CXX_FLAGS           "-fprofile-arcs -ftest-coverage" )
    set( COV_SHARED_LINKER_FLAGS "-fprofile-arcs -ftest-coverage" )
    set( COV_EXE_LINKER_FLAGS    "-fprofile-arcs -ftest-coverage" )
    #
    set( CMAKE_C_FLAGS             "${CMAKE_C_FLAGS} ${COV_C_FLAGS}"                         )
    set( CMAKE_CXX_FLAGS           "${CMAKE_CXX_FLAGS} ${COV_CXX_FLAGS}"                     )
    set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${COV_SHARED_LINKER_FLAGS}" )
    set( CMAKE_EXE_LINKER_FLAGS    "${CMAKE_EXE_LINKER_FLAGS} ${COV_EXE_LINKER_FLAGS}"       )
endif()

#
# Default install locations, override cache variables to change.
#
if(NOT CMAKE_VERSION VERSION_GREATER "2.8.4")
    set(CMAKE_INSTALL_BINDIR  bin)
    set(CMAKE_INSTALL_INCLUDE include)
    set(CMAKE_INSTALL_LIBDIR  lib)
    set(CMAKE_INSTALL_DATADIR share)
else()
    include(GNUInstallDirs)
endif()
set(CMAKE_INSTALL_CMAKEMODULESDIR ${CMAKE_INSTALL_DATADIR}/cmake-2.8/Modules)

set(BIN_INSTALL_DIR             ${CMAKE_INSTALL_BINDIR}             CACHE PATH "Location to install binaries relative to the install prefix.")
set(INCLUDE_INSTALL_DIR         ${CMAKE_INSTALL_INCLUDEDIR}         CACHE PATH "Location to install headers relative to the install prefix.")
set(LIB_INSTALL_DIR             ${CMAKE_INSTALL_LIBDIR}             CACHE PATH "Location to install libraries relative to the install prefix.")
set(DATA_INSTALL_DIR            ${CMAKE_INSTALL_DATADIR}            CACHE PATH "Location to install data files relative to the install prefix.")
set(CMAKE_MODULES_INSTALL_DIR   ${CMAKE_INSTALL_CMAKEMODULESDIR}    CACHE PATH "Location to install data files relative to the install prefix.")


find_package( ZLIB REQUIRED )

configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zipios/zipios-config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/zipios/zipios-config.hpp )

# Generate the RPM package specification file
set(PACKAGE "libzipios")
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zipios.spec.in ${CMAKE_CURRENT_BINARY_DIR}/contrib/zipios.spec )

include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${ZLIB_INCLUDE_DIRS} )

add_subdirectory( src )
add_subdirectory( tools )
add_subdirectory( tests )
add_subdirectory( doc )

install( DIRECTORY zipios
    DESTINATION ${INCLUDE_INSTALL_DIR}
    PATTERN "*.in" EXCLUDE
)

install( FILES ${CMAKE_BINARY_DIR}/zipios/zipios-config.hpp
    DESTINATION ${INCLUDE_INSTALL_DIR}/zipios
)

# TODO: how do we determine the correct destination?
#       (i.e. 3.x is now out and 2.8 will probably fail for those users)
install( DIRECTORY cmake/
    DESTINATION ${CMAKE_MODULES_INSTALL_DIR}
)

add_custom_target(zipios_code_analysis
    # Make sure we have an output folder
    COMMAND mkdir -p ${PROJECT_BINARY_DIR}/analysis

    # Boost inspect tool that reports various problems in the source
    COMMAND echo "inspect -- output ${PROJECT_BINARY_DIR}/analysis/inspect.html"
    COMMAND inspect -tab -crlf -end -path_name -ascii -minmax -assert_macro -deprecated_macro -unnamed -copyright >"${PROJECT_BINARY_DIR}/analysis/inspect.html"

    # Count the number of TODO, XXX, TBD, FIXME, and \todo
    COMMAND echo "TODO -- output ${PROJECT_BINARY_DIR}/analysis/todo.txt"
    COMMAND sh dev/todo.sh "${PROJECT_BINARY_DIR}/analysis"

    # Search for files with "invalid" (unwanted really) spaces
    COMMAND echo "Spaces -- output ${PROJECT_BINARY_DIR}/analysis/spaces.txt"
    COMMAND sh dev/spaces.sh "${PROJECT_BINARY_DIR}/analysis"

    # All of these are expected to work on source code so make sure we are
    # in the source code top directory
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)

##
## To pack the source
##
set(CPACK_PACKAGE_NAME "zipios")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Zipios++ is a small C++ library for reading and writing zip files.")
set(CPACK_PACKAGE_VENDOR "Made to Order Software Corporation")
set(CPACK_PACKAGE_CONTACT "<EMAIL>")
set(CPACK_RESOURCE_FILE_LICENSE "${zipios_project_SOURCE_DIR}/COPYING")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "/CVS/;/work-files/;/.git/;.swp$;.*~;cscope.*;/tmp/;BUILD;Build")
set(CPACK_PACKAGE_VERSION "${ZIPIOS_VERSION_MAJOR}.${ZIPIOS_VERSION_MINOR}.${ZIPIOS_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION_MAJOR "${ZIPIOS_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${ZIPIOS_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${ZIPIOS_VERSION_PATCH}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "zipios-${ZIPIOS_VERSION_MAJOR}.${ZIPIOS_VERSION_MINOR}.${ZIPIOS_VERSION_PATCH}")
include(CPack)

# Local Variables:
# indent-tabs-mode: nil
# tab-width: 4
# End:

# vim: ts=4 sw=4 et nocindent
<commit_msg>Add -D_CRT_SECURE_NO_WARNINGS<commit_after>#
# File:
#      CMakeLists.txt
#
# Description:
#      Build the Zipios++ library, tools, packages, tests, documentation.
#
# Documentation:
#      See the CMake documentation.
#
# License:
#      Zipios++ - a small C++ library that provides easy access to .zip files.
#      Copyright (C) 2000-2007  <NAME>
#      Copyright (C) 2015  Made to Order Software Corporation
#
#      This library is free software; you can redistribute it and/or
#      modify it under the terms of the GNU Lesser General Public
#      License as published by the Free Software Foundation; either
#      version 2.1 of the License, or (at your option) any later version.
#
#      This library is distributed in the hope that it will be useful,
#      but WITHOUT ANY WARRANTY; without even the implied warranty of
#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#      Lesser General Public License for more details.
#
#      You should have received a copy of the GNU Lesser General Public
#      License along with this library; if not, write to the Free Software
#      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#

cmake_minimum_required(VERSION 2.8.4)

project( zipios_project )

set( ZIPIOS_VERSION_MAJOR 2 )
set( ZIPIOS_VERSION_MINOR 1 )
set( ZIPIOS_VERSION_PATCH 1 )

set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" )

# SUNOS is not set by cmake
string( REGEX MATCH "SunOS" SUNOS ${CMAKE_SYSTEM_NAME} )

if(CMAKE_COMPILER_IS_GNU_CXX)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -fdiagnostics-show-option -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Winit-self -Wlogical-op -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=4 -Wundef -Wno-unused -Wunused-variable -Wno-variadic-macros -Wno-parentheses -Wno-unknown-pragmas -Wwrite-strings -Wswitch -Wunused-parameter -Wfloat-equal -Wold-style-cast -Wnoexcept" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3" )

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fwrapv" )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror -Wall -Wextra -Wunused-parameter" )
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3" )

if( CYGWIN )
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11" )
else()
    set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC" )
endif()
endif()

if(MSVC)
    set( CMAKE_CXX_FLAGS "-EHsc -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS" )
endif()

option(BUILD_SHARED_LIBS "Build the ${PROJECT_NAME} libraries shared." ON)

if(BUILD_SHARED_LIBS)
    set(ZIPIOS_LIBRARY_TYPE SHARED)
else(BUILD_SHARED_LIBS)
    set(ZIPIOS_LIBRARY_TYPE STATIC)
endif(BUILD_SHARED_LIBS)

option(BUILD_DOCUMENTATION "Build the ${PROJECT_NAME} documentation." ON)

# To generate coverage, use -D<project name>_COVERAGE=ON
#                       and -DCMAKE_BUILD_TYPE=Debug
option( ${PROJECT_NAME}_COVERAGE "Turn on coverage for ${PROJECT_NAME}." OFF )

if( ${${PROJECT_NAME}_COVERAGE} )
    message("*** COVERAGE TURNED ON ***")
    find_program( COV gcov )
    if( ${COV} STREQUAL "COV-NOTFOUND" )
        message( FATAL_ERROR "Coverage requested, but gcov not installed!" )
    endif()
    if( NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
        message( FATAL_ERROR "Coverage requested, but Debug is not turned on! (i.e. -DCMAKE_BUILD_TYPE=Debug)" )
    endif()
    #
    set( COV_C_FLAGS             "-fprofile-arcs -ftest-coverage" )
    set( COV_CXX_FLAGS           "-fprofile-arcs -ftest-coverage" )
    set( COV_SHARED_LINKER_FLAGS "-fprofile-arcs -ftest-coverage" )
    set( COV_EXE_LINKER_FLAGS    "-fprofile-arcs -ftest-coverage" )
    #
    set( CMAKE_C_FLAGS             "${CMAKE_C_FLAGS} ${COV_C_FLAGS}"                         )
    set( CMAKE_CXX_FLAGS           "${CMAKE_CXX_FLAGS} ${COV_CXX_FLAGS}"                     )
    set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${COV_SHARED_LINKER_FLAGS}" )
    set( CMAKE_EXE_LINKER_FLAGS    "${CMAKE_EXE_LINKER_FLAGS} ${COV_EXE_LINKER_FLAGS}"       )
endif()

#
# Default install locations, override cache variables to change.
#
if(NOT CMAKE_VERSION VERSION_GREATER "2.8.4")
    set(CMAKE_INSTALL_BINDIR  bin)
    set(CMAKE_INSTALL_INCLUDE include)
    set(CMAKE_INSTALL_LIBDIR  lib)
    set(CMAKE_INSTALL_DATADIR share)
else()
    include(GNUInstallDirs)
endif()
set(CMAKE_INSTALL_CMAKEMODULESDIR ${CMAKE_INSTALL_DATADIR}/cmake-2.8/Modules)

set(BIN_INSTALL_DIR             ${CMAKE_INSTALL_BINDIR}             CACHE PATH "Location to install binaries relative to the install prefix.")
set(INCLUDE_INSTALL_DIR         ${CMAKE_INSTALL_INCLUDEDIR}         CACHE PATH "Location to install headers relative to the install prefix.")
set(LIB_INSTALL_DIR             ${CMAKE_INSTALL_LIBDIR}             CACHE PATH "Location to install libraries relative to the install prefix.")
set(DATA_INSTALL_DIR            ${CMAKE_INSTALL_DATADIR}            CACHE PATH "Location to install data files relative to the install prefix.")
set(CMAKE_MODULES_INSTALL_DIR   ${CMAKE_INSTALL_CMAKEMODULESDIR}    CACHE PATH "Location to install data files relative to the install prefix.")


find_package( ZLIB REQUIRED )

configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zipios/zipios-config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/zipios/zipios-config.hpp )

# Generate the RPM package specification file
set(PACKAGE "libzipios")
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zipios.spec.in ${CMAKE_CURRENT_BINARY_DIR}/contrib/zipios.spec )

include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${ZLIB_INCLUDE_DIRS} )

add_subdirectory( src )
add_subdirectory( tools )
add_subdirectory( tests )
add_subdirectory( doc )

install( DIRECTORY zipios
    DESTINATION ${INCLUDE_INSTALL_DIR}
    PATTERN "*.in" EXCLUDE
)

install( FILES ${CMAKE_BINARY_DIR}/zipios/zipios-config.hpp
    DESTINATION ${INCLUDE_INSTALL_DIR}/zipios
)

# TODO: how do we determine the correct destination?
#       (i.e. 3.x is now out and 2.8 will probably fail for those users)
install( DIRECTORY cmake/
    DESTINATION ${CMAKE_MODULES_INSTALL_DIR}
)

add_custom_target(zipios_code_analysis
    # Make sure we have an output folder
    COMMAND mkdir -p ${PROJECT_BINARY_DIR}/analysis

    # Boost inspect tool that reports various problems in the source
    COMMAND echo "inspect -- output ${PROJECT_BINARY_DIR}/analysis/inspect.html"
    COMMAND inspect -tab -crlf -end -path_name -ascii -minmax -assert_macro -deprecated_macro -unnamed -copyright >"${PROJECT_BINARY_DIR}/analysis/inspect.html"

    # Count the number of TODO, XXX, TBD, FIXME, and \todo
    COMMAND echo "TODO -- output ${PROJECT_BINARY_DIR}/analysis/todo.txt"
    COMMAND sh dev/todo.sh "${PROJECT_BINARY_DIR}/analysis"

    # Search for files with "invalid" (unwanted really) spaces
    COMMAND echo "Spaces -- output ${PROJECT_BINARY_DIR}/analysis/spaces.txt"
    COMMAND sh dev/spaces.sh "${PROJECT_BINARY_DIR}/analysis"

    # All of these are expected to work on source code so make sure we are
    # in the source code top directory
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)

##
## To pack the source
##
set(CPACK_PACKAGE_NAME "zipios")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Zipios++ is a small C++ library for reading and writing zip files.")
set(CPACK_PACKAGE_VENDOR "Made to Order Software Corporation")
set(CPACK_PACKAGE_CONTACT "<EMAIL>")
set(CPACK_RESOURCE_FILE_LICENSE "${zipios_project_SOURCE_DIR}/COPYING")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "/CVS/;/work-files/;/.git/;.swp$;.*~;cscope.*;/tmp/;BUILD;Build")
set(CPACK_PACKAGE_VERSION "${ZIPIOS_VERSION_MAJOR}.${ZIPIOS_VERSION_MINOR}.${ZIPIOS_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION_MAJOR "${ZIPIOS_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${ZIPIOS_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${ZIPIOS_VERSION_PATCH}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "zipios-${ZIPIOS_VERSION_MAJOR}.${ZIPIOS_VERSION_MINOR}.${ZIPIOS_VERSION_PATCH}")
include(CPack)

# Local Variables:
# indent-tabs-mode: nil
# tab-width: 4
# End:

# vim: ts=4 sw=4 et nocindent

{'fraction_non_alphanumeric': 0.10285505124450951, 'fraction_numerical': 0.0061005368472425575, 'mean_word_length': 4.293186955117856, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '710631', 'n_tokens_mistral': 6023, 'n_tokens_neox': 5672, 'n_words': 1380}