keepassxc/CMakeLists.txt

439 lines
15 KiB
CMake
Raw Normal View History

2018-10-19 15:41:56 -04:00
# Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
2010-08-07 09:10:44 -04:00
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 or (at your option)
# version 3 of the License.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.1.0)
project(KeePassXC)
if(NOT CMAKE_BUILD_TYPE)
2018-10-19 15:41:56 -04:00
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo Debug DebugFull Profile MinSizeRel."
FORCE)
endif()
2012-05-21 17:37:29 -04:00
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
2017-05-05 20:20:27 -04:00
# Support Visual Studio Code
include(CMakeToolsHelpers OPTIONAL)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
2010-08-13 12:08:06 -04:00
option(WITH_TESTS "Enable building of unit tests" ON)
2011-12-26 13:18:21 -05:00
option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
option(WITH_DEV_BUILD "Use only for development. Disables/warns about deprecated methods." OFF)
2017-10-15 18:27:07 -04:00
option(WITH_ASAN "Enable address sanitizer checks (Linux / macOS only)" OFF)
2017-03-15 10:26:40 -04:00
option(WITH_COVERAGE "Use to build with coverage tests (GCC only)." OFF)
option(WITH_APP_BUNDLE "Enable Application Bundle for macOS" ON)
2010-08-07 09:10:44 -04:00
set(WITH_XC_ALL OFF CACHE BOOLEAN "Build in all available plugins")
option(WITH_XC_AUTOTYPE "Include Auto-Type." ON)
option(WITH_XC_NETWORKING "Include networking code (e.g. for downlading website icons)." OFF)
option(WITH_XC_BROWSER "Include browser integration with keepassxc-browser." OFF)
2017-02-25 11:11:02 -05:00
option(WITH_XC_YUBIKEY "Include YubiKey support." OFF)
2017-10-29 11:17:24 -04:00
option(WITH_XC_SSHAGENT "Include SSH agent support." OFF)
option(WITH_XC_KEESHARE "Sharing integration with KeeShare" OFF)
option(WITH_XC_KEESHARE_SECURE "Sharing integration with secured KeeShare containers" OFF)
2018-04-04 11:39:26 -04:00
if(APPLE)
2018-10-19 15:41:56 -04:00
option(WITH_XC_TOUCHID "Include TouchID support for macOS." OFF)
2018-04-04 11:39:26 -04:00
endif()
if(WITH_XC_ALL)
2018-10-19 15:41:56 -04:00
# Enable all options
set(WITH_XC_AUTOTYPE ON)
set(WITH_XC_NETWORKING ON)
set(WITH_XC_BROWSER ON)
set(WITH_XC_YUBIKEY ON)
set(WITH_XC_SSHAGENT ON)
set(WITH_XC_KEESHARE ON)
if(APPLE)
set(WITH_XC_TOUCHID ON)
endif()
endif()
if(WITH_XC_KEESHARE_SECURE)
set(WITH_XC_KEESHARE ON)
endif()
if(WITH_XC_SSHAGENT OR WITH_XC_KEESHARE)
set(WITH_XC_CRYPTO_SSH ON)
else()
set(WITH_XC_CRYPTO_SSH OFF)
endif()
2017-05-06 11:50:05 -04:00
set(KEEPASSXC_VERSION_MAJOR "2")
2018-08-28 21:30:56 -04:00
set(KEEPASSXC_VERSION_MINOR "4")
set(KEEPASSXC_VERSION_PATCH "0")
2017-05-06 11:50:05 -04:00
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION_MAJOR}.${KEEPASSXC_VERSION_MINOR}.${KEEPASSXC_VERSION_PATCH}")
2010-08-13 12:08:06 -04:00
2018-02-17 11:46:19 -05:00
set(KEEPASSXC_BUILD_TYPE "Snapshot" CACHE STRING "Set KeePassXC build type to distinguish between stable releases and snapshots")
set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release PreRelease)
# Retrieve git HEAD revision hash
set(GIT_HEAD_OVERRIDE "" CACHE STRING "Manually set the Git HEAD hash when missing (eg, when no .git folder exists)")
execute_process(COMMAND git rev-parse --short=7 HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HEAD
ERROR_QUIET)
string(STRIP "${GIT_HEAD}" GIT_HEAD)
if(GIT_HEAD STREQUAL "")
string(SUBSTRING "${GIT_HEAD_OVERRIDE}" 0 7 GIT_HEAD)
endif()
message(STATUS "Found Git HEAD Revision: ${GIT_HEAD}\n")
# Check if on a tag, if so build as a release
execute_process(COMMAND git tag --points-at HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG
ERROR_QUIET)
if(GIT_TAG)
string(STRIP "${GIT_TAG}" GIT_TAG)
2018-10-19 15:41:56 -04:00
set(OVERRIDE_VERSION ${GIT_TAG})
elseif(EXISTS ${CMAKE_SOURCE_DIR}/.version)
2018-10-19 15:41:56 -04:00
file(READ ${CMAKE_SOURCE_DIR}/.version OVERRIDE_VERSION)
endif()
2018-02-17 11:46:19 -05:00
string(REGEX REPLACE "(\r?\n)+" "" OVERRIDE_VERSION "${OVERRIDE_VERSION}")
if(OVERRIDE_VERSION)
2018-10-19 15:41:56 -04:00
if(OVERRIDE_VERSION MATCHES "^[\\.0-9]+-(alpha|beta)[0-9]+$")
set(KEEPASSXC_BUILD_TYPE PreRelease)
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
elseif(OVERRIDE_VERSION MATCHES "^[\\.0-9]+$")
set(KEEPASSXC_BUILD_TYPE Release)
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
endif()
2018-02-17 11:46:19 -05:00
endif()
if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT OVERRIDE_VERSION)
2018-10-19 15:41:56 -04:00
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview")
2018-02-17 11:46:19 -05:00
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot")
2018-10-19 15:41:56 -04:00
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")
endif()
2018-02-17 11:46:19 -05:00
if(KEEPASSXC_BUILD_TYPE STREQUAL "Release")
2018-10-19 15:41:56 -04:00
set(KEEPASSXC_BUILD_TYPE_RELEASE ON)
2018-02-17 11:46:19 -05:00
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease")
2018-10-19 15:41:56 -04:00
set(KEEPASSXC_BUILD_TYPE_PRE_RELEASE ON)
2018-02-17 11:46:19 -05:00
else()
2018-10-19 15:41:56 -04:00
set(KEEPASSXC_BUILD_TYPE_SNAPSHOT ON)
2018-02-17 11:46:19 -05:00
endif()
message(STATUS "Setting up build for KeePassXC v${KEEPASSXC_VERSION}\n")
# Distribution info
2018-02-17 11:46:19 -05:00
set(KEEPASSXC_DIST ON)
set(KEEPASSXC_DIST_TYPE "Other" CACHE STRING "KeePassXC Distribution Type")
set_property(CACHE KEEPASSXC_DIST_TYPE PROPERTY STRINGS Snap AppImage Other)
if(KEEPASSXC_DIST_TYPE STREQUAL "Snap")
2018-10-19 15:41:56 -04:00
set(KEEPASSXC_DIST_SNAP ON)
elseif(KEEPASSXC_DIST_TYPE STREQUAL "AppImage")
2018-10-19 15:41:56 -04:00
set(KEEPASSXC_DIST_APPIMAGE ON)
elseif(KEEPASSXC_DIST_TYPE STREQUAL "Other")
2018-10-19 15:41:56 -04:00
unset(KEEPASSXC_DIST)
endif()
2018-05-09 06:47:34 -04:00
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
2018-10-19 15:41:56 -04:00
set(IS_32BIT TRUE)
2018-05-09 06:47:34 -04:00
endif()
if("${CMAKE_C_COMPILER}" MATCHES "clang$" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
2018-10-19 15:41:56 -04:00
set(CMAKE_COMPILER_IS_CLANG 1)
2012-05-21 17:37:29 -04:00
endif()
if("${CMAKE_CXX_COMPILER}" MATCHES "clang(\\+\\+)?$" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
2018-10-19 15:41:56 -04:00
set(CMAKE_COMPILER_IS_CLANGXX 1)
2012-05-21 17:37:29 -04:00
endif()
2012-04-18 10:10:40 -04:00
macro(add_gcc_compiler_cxxflags FLAGS)
2018-10-19 15:41:56 -04:00
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
endif()
endmacro(add_gcc_compiler_cxxflags)
macro(add_gcc_compiler_cflags FLAGS)
2018-10-19 15:41:56 -04:00
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
endif()
endmacro(add_gcc_compiler_cflags)
macro(add_gcc_compiler_flags FLAGS)
2018-10-19 15:41:56 -04:00
add_gcc_compiler_cxxflags("${FLAGS}")
add_gcc_compiler_cflags("${FLAGS}")
endmacro(add_gcc_compiler_flags)
2012-04-18 10:10:40 -04:00
add_definitions(-DQT_NO_EXCEPTIONS -DQT_STRICT_ITERATORS -DQT_NO_CAST_TO_ASCII)
2017-05-05 13:49:52 -04:00
if(WITH_APP_BUNDLE)
2018-10-19 15:41:56 -04:00
add_definitions(-DWITH_APP_BUNDLE)
2017-05-05 13:49:52 -04:00
endif()
add_gcc_compiler_flags("-fno-common")
add_gcc_compiler_flags("-Wall -Wextra -Wundef -Wpointer-arith -Wno-long-long")
add_gcc_compiler_flags("-Wformat=2 -Wmissing-format-attribute")
add_gcc_compiler_flags("-fvisibility=hidden")
add_gcc_compiler_cxxflags("-fvisibility-inlines-hidden")
2012-04-18 10:10:40 -04:00
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
2018-10-19 15:41:56 -04:00
add_gcc_compiler_flags("-Werror")
endif()
if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8.999) OR CMAKE_COMPILER_IS_CLANGXX)
add_gcc_compiler_flags("-fstack-protector-strong")
else()
add_gcc_compiler_flags("-fstack-protector --param=ssp-buffer-size=4")
endif()
add_gcc_compiler_cxxflags("-fno-exceptions -fno-rtti")
add_gcc_compiler_cxxflags("-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual")
add_gcc_compiler_cflags("-Wchar-subscripts -Wwrite-strings")
2017-03-14 09:29:09 -04:00
if(WITH_ASAN)
2018-10-19 15:41:56 -04:00
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR APPLE))
message(FATAL_ERROR "WITH_ASAN is only supported on Linux / macOS at the moment.")
endif()
2018-10-19 15:41:56 -04:00
add_gcc_compiler_flags("-fsanitize=address -DWITH_ASAN")
2017-03-14 09:53:29 -04:00
2018-10-19 15:41:56 -04:00
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(NOT (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9))
add_gcc_compiler_flags("-fsanitize=leak -DWITH_LSAN")
endif()
endif()
2017-03-14 09:29:09 -04:00
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
2018-10-19 15:41:56 -04:00
if(CMAKE_BUILD_TYPE_LOWER MATCHES "(release|relwithdebinfo|minsizerel)")
add_gcc_compiler_flags("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2")
endif()
check_c_compiler_flag("-Werror=format-security -Werror=implicit-function-declaration" WERROR_C_AVAILABLE)
check_cxx_compiler_flag("-Werror=format-security" WERROR_CXX_AVAILABLE)
if(WERROR_C_AVAILABLE AND WERROR_CXX_AVAILABLE)
2018-10-19 15:41:56 -04:00
add_gcc_compiler_flags("-Werror=format-security")
add_gcc_compiler_cflags("-Werror=implicit-function-declaration")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
2018-10-19 15:41:56 -04:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align")
2012-05-21 17:37:29 -04:00
endif()
if(CMAKE_COMPILER_IS_GNUCC)
2018-10-19 15:41:56 -04:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-align")
2012-05-21 17:37:29 -04:00
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
2018-10-19 15:41:56 -04:00
if(CMAKE_COMPILER_IS_CLANGXX)
add_gcc_compiler_flags("-Qunused-arguments")
endif()
add_gcc_compiler_flags("-pie -fPIE")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-add-needed -Wl,--as-needed -Wl,--no-undefined")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-add-needed -Wl,--as-needed")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
2012-05-21 17:37:29 -04:00
endif()
2010-08-07 09:10:44 -04:00
add_gcc_compiler_cflags("-std=c99")
add_gcc_compiler_cxxflags("-std=c++11")
2012-04-18 14:18:48 -04:00
2015-07-24 12:28:12 -04:00
if(APPLE)
2018-10-19 15:41:56 -04:00
add_gcc_compiler_cxxflags("-stdlib=libc++")
2012-05-21 17:37:29 -04:00
endif()
2012-04-18 14:18:48 -04:00
if(WITH_DEV_BUILD)
2018-10-19 15:41:56 -04:00
add_definitions(-DQT_DEPRECATED_WARNINGS -DGCRYPT_NO_DEPRECATED)
2012-06-29 08:14:58 -04:00
endif()
if(MINGW)
2018-10-19 15:41:56 -04:00
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
# Enable DEP and ASLR
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--nxcompat -Wl,--dynamicbase")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--nxcompat -Wl,--dynamicbase")
# Enable high entropy ASLR for 64-bit builds
if(NOT IS_32BIT)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--high-entropy-va")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--high-entropy-va")
endif()
2018-05-09 06:47:34 -04:00
endif()
endif()
2017-05-05 13:49:52 -04:00
if(APPLE AND WITH_APP_BUNDLE OR MINGW)
2018-10-19 15:41:56 -04:00
set(PROGNAME KeePassXC)
2012-05-21 17:37:29 -04:00
else()
2018-10-19 15:41:56 -04:00
set(PROGNAME keepassxc)
2012-05-21 17:37:29 -04:00
endif()
2010-08-07 09:10:44 -04:00
if(MINGW)
2018-10-19 15:41:56 -04:00
set(CLI_INSTALL_DIR ".")
set(PROXY_INSTALL_DIR ".")
set(BIN_INSTALL_DIR ".")
set(PLUGIN_INSTALL_DIR ".")
set(DATA_INSTALL_DIR "share")
2017-05-05 13:49:52 -04:00
elseif(APPLE AND WITH_APP_BUNDLE)
set(CMAKE_INSTALL_MANDIR "${PROGNAME}.app/Contents/Resources/man")
set(CLI_INSTALL_DIR "${PROGNAME}.app/Contents/MacOS")
set(PROXY_INSTALL_DIR "${PROGNAME}.app/Contents/MacOS")
set(BIN_INSTALL_DIR "${PROGNAME}.app/Contents/MacOS")
2018-10-19 15:41:56 -04:00
set(PLUGIN_INSTALL_DIR "${PROGNAME}.app/Contents/PlugIns")
set(DATA_INSTALL_DIR "${PROGNAME}.app/Contents/Resources")
2012-05-21 17:37:29 -04:00
else()
2018-10-19 15:41:56 -04:00
include(GNUInstallDirs)
2018-10-19 15:41:56 -04:00
set(CLI_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
set(PROXY_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/keepassxc")
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/keepassxc")
2012-05-21 17:37:29 -04:00
endif()
2012-05-21 17:37:29 -04:00
if(WITH_TESTS)
2018-10-19 15:41:56 -04:00
enable_testing()
2012-05-21 17:37:29 -04:00
endif(WITH_TESTS)
2010-08-13 12:08:06 -04:00
if(WITH_COVERAGE)
2018-10-19 15:41:56 -04:00
# Include code coverage, use with -DCMAKE_BUILD_TYPE=Debug
include(CodeCoverage)
set(COVERAGE_GCOVR_EXCLUDES
"\\(.+/\\)?tests/.\\*"
".\\*/moc_\\[^/\\]+\\.cpp"
".\\*/ui_\\[^/\\]+\\.h"
"\\(.+/\\)?zxcvbn/.\\*")
append_coverage_compiler_flags()
setup_target_for_coverage_gcovr_html(
NAME coverage
EXECUTABLE $(MAKE) && $(MAKE) test
)
endif()
2018-01-14 10:11:00 -05:00
include(CLangFormat)
2018-10-19 15:41:56 -04:00
set(QT_COMPONENTS Core Network Concurrent Gui Svg Widgets Test LinguistTools)
2017-10-15 18:27:07 -04:00
if(UNIX AND NOT APPLE)
2018-10-19 15:41:56 -04:00
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} DBus REQUIRED)
2017-10-15 18:27:07 -04:00
elseif(APPLE)
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED HINTS /usr/local/opt/qt/lib/cmake /usr/local/Cellar/qt/*/lib/cmake ENV PATH)
find_package(Qt5 COMPONENTS MacExtras HINTS /usr/local/opt/qt/lib/cmake /usr/local/Cellar/qt/*/lib/cmake ENV PATH)
2017-10-15 18:27:07 -04:00
else()
2018-10-19 15:41:56 -04:00
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
2017-10-15 18:27:07 -04:00
endif()
if(Qt5Core_VERSION VERSION_LESS "5.2.0")
2018-10-19 15:41:56 -04:00
message(FATAL_ERROR "Qt version 5.2.0 or higher is required")
endif()
2017-10-15 18:27:07 -04:00
get_filename_component(Qt5_PREFIX ${Qt5_DIR}/../../.. REALPATH)
# Process moc automatically
2015-07-22 10:59:38 -04:00
set(CMAKE_AUTOMOC ON)
# Process .ui files automatically
2017-10-15 18:27:07 -04:00
set(CMAKE_AUTOUIC ON)
# Process .qrc files automatically
2017-10-15 18:27:07 -04:00
set(CMAKE_AUTORCC ON)
if(APPLE)
2018-10-19 15:41:56 -04:00
set(CMAKE_MACOSX_RPATH TRUE)
find_program(MACDEPLOYQT_EXE macdeployqt HINTS ${Qt5_PREFIX}/bin ENV PATH)
if(NOT MACDEPLOYQT_EXE)
message(FATAL_ERROR "macdeployqt is required to build in macOS")
else()
message(STATUS "Using macdeployqt: ${MACDEPLOYQT_EXE}")
endif()
2017-10-15 18:27:07 -04:00
endif()
# Debian sets the the build type to None for package builds.
# Make sure we don't enable asserts there.
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_NONE QT_NO_DEBUG)
2010-08-07 09:10:44 -04:00
2017-01-25 20:58:46 -05:00
find_package(LibGPGError REQUIRED)
find_package(Gcrypt 1.7.0 REQUIRED)
find_package(Argon2 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(QREncode REQUIRED)
set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR})
2017-10-15 08:02:34 -04:00
if(ZLIB_VERSION_STRING VERSION_LESS "1.2.0")
2018-10-19 15:41:56 -04:00
message(FATAL_ERROR "zlib 1.2.0 or higher is required to use the gzip format")
2012-05-21 17:37:29 -04:00
endif()
2018-06-10 18:16:30 -04:00
include_directories(SYSTEM ${ARGON2_INCLUDE_DIR})
# Optional
if(WITH_XC_KEESHARE)
2019-01-10 09:57:13 -05:00
set(WITH_XC_KEESHARE_INSECURE ON)
if(WITH_XC_KEESHARE_SECURE)
2019-01-10 09:57:13 -05:00
# ZLIB is needed and already required
find_package(QuaZip REQUIRED)
include_directories(SYSTEM ${QUAZIP_INCLUDE_DIR})
endif()
else()
set(WITH_XC_KEESHARE_INSECURE OFF)
set(WITH_XC_KEESHARE_SECURE OFF)
endif()
# Optional
if(WITH_XC_YUBIKEY)
2018-10-19 15:41:56 -04:00
find_package(YubiKey REQUIRED)
2018-10-19 15:41:56 -04:00
include_directories(SYSTEM ${YUBIKEY_INCLUDE_DIRS})
endif()
if(UNIX)
2018-10-19 15:41:56 -04:00
check_cxx_source_compiles("#include <sys/prctl.h>
int main() { prctl(PR_SET_DUMPABLE, 0); return 0; }"
2018-10-19 15:41:56 -04:00
HAVE_PR_SET_DUMPABLE)
2018-10-19 15:41:56 -04:00
check_cxx_source_compiles("#include <sys/resource.h>
int main() {
struct rlimit limit;
limit.rlim_cur = 0;
limit.rlim_max = 0;
setrlimit(RLIMIT_CORE, &limit);
return 0;
}" HAVE_RLIMIT_CORE)
2018-10-19 15:41:56 -04:00
if(APPLE)
check_cxx_source_compiles("#include <sys/types.h>
#include <sys/ptrace.h>
int main() { ptrace(PT_DENY_ATTACH, 0, 0, 0); return 0; }"
2018-10-19 15:41:56 -04:00
HAVE_PT_DENY_ATTACH)
endif()
endif()
2017-02-15 18:44:20 -05:00
include_directories(SYSTEM ${GCRYPT_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
2015-07-22 10:59:38 -04:00
include(FeatureSummary)
2010-08-07 09:10:44 -04:00
add_subdirectory(src)
add_subdirectory(share)
2012-05-21 17:37:29 -04:00
if(WITH_TESTS)
2018-10-19 15:41:56 -04:00
add_subdirectory(tests)
2012-05-21 17:37:29 -04:00
endif(WITH_TESTS)
if(PRINT_SUMMARY)
2018-10-19 15:41:56 -04:00
# This will print ENABLED, REQUIRED and DISABLED
feature_summary(WHAT ALL)
else()
2018-10-19 15:41:56 -04:00
# This will only print ENABLED and DISABLED feature
feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
endif()