2021-01-15 05:00:19 +01:00
|
|
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
2019-10-20 17:57:58 +02:00
|
|
|
|
|
|
|
# TODO Remove this deprecated policy switch once we're on cmake 3.4 or later
|
|
|
|
cmake_policy(SET CMP0065 OLD)
|
2016-01-12 14:21:57 +01:00
|
|
|
|
2018-05-19 23:42:00 +02:00
|
|
|
# TODO Perf test:
|
|
|
|
# - try if setting CRYPTOPP_NATIVE_ARCH=ON and adding -march=native to the compile commands for cryfs source files makes a difference
|
|
|
|
# -> if yes, offer a cmake option to enable both of these
|
|
|
|
|
2016-06-01 14:19:17 +02:00
|
|
|
project(cryfs)
|
|
|
|
|
2019-02-28 08:34:49 +01:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake-utils)
|
|
|
|
include(utils)
|
2015-02-17 01:02:15 +01:00
|
|
|
|
2021-04-18 09:48:18 +02:00
|
|
|
require_gcc_version(7.0)
|
|
|
|
require_clang_version(7.0)
|
2015-03-16 02:15:51 +01:00
|
|
|
|
2016-02-14 16:25:21 +01:00
|
|
|
# Default value is not to build test cases
|
2018-05-20 23:11:54 +02:00
|
|
|
option(BUILD_TESTING "build test cases" OFF)
|
|
|
|
option(CRYFS_UPDATE_CHECKS "let cryfs check for updates and security vulnerabilities" ON)
|
2018-05-20 23:15:18 +02:00
|
|
|
option(DISABLE_OPENMP "allow building without OpenMP libraries. This will cause performance degradations." OFF)
|
2018-10-03 05:51:33 +02:00
|
|
|
|
|
|
|
# The following options are helpful for development and/or CI
|
|
|
|
option(USE_WERROR "build with -Werror flag")
|
2018-09-30 03:01:38 +02:00
|
|
|
option(USE_CLANG_TIDY "build with clang-tidy checks enabled" OFF)
|
2018-10-21 11:46:27 +02:00
|
|
|
option(USE_IWYU "build with iwyu checks enabled" OFF)
|
2018-09-30 03:01:38 +02:00
|
|
|
option(CLANG_TIDY_WARNINGS_AS_ERRORS "treat clang-tidy warnings as errors" OFF)
|
2016-02-14 17:06:06 +01:00
|
|
|
|
2020-07-01 06:49:09 +02:00
|
|
|
set(DEPENDENCY_CONFIG "cmake-utils/DependenciesFromConan.cmake" CACHE FILEPATH "cmake configuration file defining how to get dependencies")
|
2018-10-03 05:51:33 +02:00
|
|
|
|
2018-09-16 02:42:32 +02:00
|
|
|
if (MSVC)
|
2018-09-18 13:35:50 +02:00
|
|
|
option(DOKAN_PATH "Location of the Dokan library, e.g. C:\\Program Files\\Dokan\\DokanLibrary-1.1.0" "")
|
2018-09-16 02:42:32 +02:00
|
|
|
endif()
|
|
|
|
|
2018-11-10 22:25:15 +01:00
|
|
|
# Default value is to build in release mode but with debug symbols
|
2016-02-14 17:06:06 +01:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2018-11-10 22:25:15 +01:00
|
|
|
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE INTERNAL "CMAKE_BUILD_TYPE")
|
2016-02-14 17:06:06 +01:00
|
|
|
endif(NOT CMAKE_BUILD_TYPE)
|
2016-02-14 16:25:21 +01:00
|
|
|
|
2021-01-07 05:42:07 +01:00
|
|
|
# Enable LTO if we're in a release build and LTO is supported
|
2021-01-13 22:31:15 +01:00
|
|
|
string(TOUPPER ${CMAKE_BUILD_TYPE} _CMAKE_BUILD_TYPE_UPPER)
|
|
|
|
if (_CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG")
|
|
|
|
message(STATUS "LTO disabled because we're in a debug build")
|
|
|
|
else()
|
|
|
|
include(CheckIPOSupported)
|
|
|
|
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
|
|
|
|
if(LTO_SUPPORTED)
|
2021-01-07 05:42:07 +01:00
|
|
|
message(STATUS "LTO enabled")
|
|
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
2021-01-13 22:31:15 +01:00
|
|
|
else()
|
|
|
|
message(WARNING "LTO disabled because compiler does not support it.")
|
2021-01-07 05:42:07 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-07-18 06:08:17 +02:00
|
|
|
# The MSVC version on AppVeyor CI needs this
|
|
|
|
if(MSVC)
|
|
|
|
add_definitions(/bigobj)
|
|
|
|
endif()
|
2016-09-24 13:16:26 +02:00
|
|
|
|
2020-07-01 06:49:09 +02:00
|
|
|
include(${DEPENDENCY_CONFIG})
|
2020-02-24 09:51:48 +01:00
|
|
|
|
2019-03-30 05:21:37 +01:00
|
|
|
add_subdirectory(vendor EXCLUDE_FROM_ALL)
|
2016-02-10 00:58:03 +01:00
|
|
|
add_subdirectory(src)
|
2017-03-26 15:08:47 +02:00
|
|
|
add_subdirectory(doc)
|
2016-02-10 00:58:03 +01:00
|
|
|
add_subdirectory(test)
|
2016-02-11 17:34:08 +01:00
|
|
|
add_subdirectory(cpack)
|