<commit_before>cmake_minimum_required (VERSION 3.5)
# CMAKE_EXPORT_COMPILE_COMMANDS requires 3.5
# CMAKE_CXX_STANDARD and CMAKE_CXX_EXTENSIONS require 3.1.3

# GLOB_RECURSE calls should not follow symlinks by default:
cmake_policy(SET CMP0009 NEW)

project(aktualizr)

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Release")
    message(STATUS "No CMAKE_BUILD_TYPE specified, defaulting to ${CMAKE_BUILD_TYPE}")
endif(NOT CMAKE_BUILD_TYPE)

if(CMAKE_BUILD_TYPE MATCHES "Valgrind")
    set(TESTSUITE_VALGRIND_DEFAULT ON)
else()
    set(TESTSUITE_VALGRIND_DEFAULT OFF)
endif()

option(WARNING_AS_ERROR "Treat warnings as errors" ON)
option(PEDANTIC_WARNINGS "Compile with pedantic warnings" OFF)
option(BUILD_WITH_CODE_COVERAGE "Enable gcov code coverage" OFF)
option(BUILD_OSTREE "Set to ON to compile with ostree support" OFF)
option(BUILD_DEB "Set to ON to compile with debian packages support" OFF)
option(BUILD_DOCKERAPP "Set to ON to compile with package manager support of docker-app" OFF)
option(BUILD_P11 "Support for key storage in a HSM via PKCS#11" OFF)
option(BUILD_SOTA_TOOLS "Set to ON to build SOTA tools" OFF)
option(BUILD_ISOTP "Set to ON to compile with ISO/TP protocol support" OFF)
option(BUILD_LOAD_TESTS "Set to ON to build load tests" OFF)
option(FAULT_INJECTION "Set to ON to enable fault injection" OFF)
option(INSTALL_LIB "Set to ON to install library and headers" OFF)
option(TESTSUITE_VALGRIND "Set to ON to make tests to run under valgrind (default when CMAKE_BUILD_TYPE=Valgrind)" ${TESTSUITE_VALGRIND_DEFAULT})
option(CCACHE "Set to ON to use ccache if available" ON)

set(SOTA_PACKED_CREDENTIALS "" CACHE STRING "Credentials.zip for tests involving the server")

set(TESTSUITE_ONLY "" CACHE STRING "Only run tests matching this list of labels")
set(TESTSUITE_EXCLUDE "" CACHE STRING "Exclude tests matching this list of labels")

set(STORAGE_TYPE "sqlite" CACHE STRING "")

if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
    message(FATAL_ERROR "Aktualizr does not support building in the source tree. Please remove CMakeCache.txt and the CMakeFiles/ directory, then create a subdirectory to build in: mkdir build; cd build; cmake ..")
endif()

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake-modules)
configure_file(CTestCustom.cmake CTestCustom.cmake)

unset(AKTUALIZR_CHECKED_SRCS CACHE)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if (CCACHE)
    find_program(CCACHE_PROGRAM ccache)
    if (CCACHE_PROGRAM)
        set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
    endif (CCACHE_PROGRAM)
endif (CCACHE)

# find all required libraries
set(BOOST_COMPONENTS log_setup log system filesystem program_options)
set(Boost_USE_STATIC_LIBS OFF)
add_definitions(-DBOOST_LOG_DYN_LINK)

if(ANDROID)<commit_msg>Use 64-bit filesystem interface on 32-bit systems<commit_after>cmake_minimum_required (VERSION 3.5)
# CMAKE_EXPORT_COMPILE_COMMANDS requires 3.5
# CMAKE_CXX_STANDARD and CMAKE_CXX_EXTENSIONS require 3.1.3

# GLOB_RECURSE calls should not follow symlinks by default:
cmake_policy(SET CMP0009 NEW)

project(aktualizr)

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Release")
    message(STATUS "No CMAKE_BUILD_TYPE specified, defaulting to ${CMAKE_BUILD_TYPE}")
endif(NOT CMAKE_BUILD_TYPE)

if(CMAKE_BUILD_TYPE MATCHES "Valgrind")
    set(TESTSUITE_VALGRIND_DEFAULT ON)
else()
    set(TESTSUITE_VALGRIND_DEFAULT OFF)
endif()

option(WARNING_AS_ERROR "Treat warnings as errors" ON)
option(PEDANTIC_WARNINGS "Compile with pedantic warnings" OFF)
option(BUILD_WITH_CODE_COVERAGE "Enable gcov code coverage" OFF)
option(BUILD_OSTREE "Set to ON to compile with ostree support" OFF)
option(BUILD_DEB "Set to ON to compile with debian packages support" OFF)
option(BUILD_DOCKERAPP "Set to ON to compile with package manager support of docker-app" OFF)
option(BUILD_P11 "Support for key storage in a HSM via PKCS#11" OFF)
option(BUILD_SOTA_TOOLS "Set to ON to build SOTA tools" OFF)
option(BUILD_ISOTP "Set to ON to compile with ISO/TP protocol support" OFF)
option(BUILD_LOAD_TESTS "Set to ON to build load tests" OFF)
option(FAULT_INJECTION "Set to ON to enable fault injection" OFF)
option(INSTALL_LIB "Set to ON to install library and headers" OFF)
option(TESTSUITE_VALGRIND "Set to ON to make tests to run under valgrind (default when CMAKE_BUILD_TYPE=Valgrind)" ${TESTSUITE_VALGRIND_DEFAULT})
option(CCACHE "Set to ON to use ccache if available" ON)

set(SOTA_PACKED_CREDENTIALS "" CACHE STRING "Credentials.zip for tests involving the server")

set(TESTSUITE_ONLY "" CACHE STRING "Only run tests matching this list of labels")
set(TESTSUITE_EXCLUDE "" CACHE STRING "Exclude tests matching this list of labels")

set(STORAGE_TYPE "sqlite" CACHE STRING "")

if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
    message(FATAL_ERROR "Aktualizr does not support building in the source tree. Please remove CMakeCache.txt and the CMakeFiles/ directory, then create a subdirectory to build in: mkdir build; cd build; cmake ..")
endif()

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake-modules)
configure_file(CTestCustom.cmake CTestCustom.cmake)

unset(AKTUALIZR_CHECKED_SRCS CACHE)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# To ensure better support of large files on 32-bit systems.
# See https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
add_definitions("-D_FILE_OFFSET_BITS=64")

if (CCACHE)
    find_program(CCACHE_PROGRAM ccache)
    if (CCACHE_PROGRAM)
        set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
    endif (CCACHE_PROGRAM)
endif (CCACHE)

# find all required libraries
set(BOOST_COMPONENTS log_setup log system filesystem program_options)
set(Boost_USE_STATIC_LIBS OFF)
add_definitions(-DBOOST_LOG_DYN_LINK)

if(ANDROID)
{'fraction_non_alphanumeric': 0.07512144344205413, 'fraction_numerical': 0.00659264399722415, 'mean_word_length': 6.506510416666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '7608273', 'n_tokens_mistral': 2035, 'n_tokens_neox': 1947, 'n_words': 586}