1 cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
2 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
6 include (FeatureSummary)
7 find_package (ARPA2CM 0.5 QUIET NO_MODULE)
8 set_package_properties (ARPA2CM PROPERTIES
9 DESCRIPTION "CMake modules for ARPA2 projects"
11 URL "https://github.com/arpa2/arpa2cm/"
12 PURPOSE "Required for the CMake build system for ${PROJECT}"
15 set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ARPA2CM_MODULE_PATH})
17 feature_summary (WHAT ALL)
18 message (FATAL_ERROR "ARPA2CM is required.")
21 include(MacroEnsureOutOfSourceBuild)
22 include(MacroGitVersionInfo)
25 include(FeatureSummary)
26 include(GNUInstallDirs)
28 set(CMAKE_C_STANDARD 99)
29 set(CMAKE_C_STANDARD_REQUIRED ON)
31 macro_ensure_out_of_source_build(
32 "Do not build TLSPool in the source directory.")
33 get_version_from_git(TLSPool 0.20)
35 # Finding dependencies, find-modules provided by:
36 # - "ARPA" is shipped with ARPA2CM
37 # - "Module" is shipped with CMake itself
38 # - "Config" is shipped with that software package
40 find_package(BDB REQUIRED) # ARPA
41 find_package(GnuTLS REQUIRED) # Module
42 find_package(GnuTLSDane REQUIRED) # ARPA
43 find_package(KERBEROS REQUIRED) # Local
44 find_package(Libldns REQUIRED) # ARPA
45 find_package(LibTASN1 REQUIRED) # ARPA
46 find_package(OpenLDAP REQUIRED) # ARPA
47 find_package(P11-Kit REQUIRED) # ARPA
48 find_package(Quick-DER 1.2.4 REQUIRED NO_MODULE) # Config
49 find_package(Unbound REQUIRED) # ARPA
50 find_package(com_err REQUIRED) # Local
52 # TODO: look for TLS-KDH
55 add_definitions(-DHAVE_GNUTLS_DANE)
59 feature_summary(WHAT ALL VAR _features)
60 message(STATUS ${_features})
62 option(DEBUG "Produce debugging output (for developers)" OFF)
64 option(TEST_UNDER_TLSPOOL "Test under the assumption of an available TLS Pool" OFF)
66 option(EXPERIMENTAL_SRP_SUPPORT "Enable support for SRP based on relative file names" OFF)
67 if (EXPERIMENTAL_SRP_SUPPORT)
68 add_definitions(-DEXPERIMENTAL_SRP)
71 option(EXPERIMENTAL_LIBEV "Experiment with libev as a event backend" OFF)
73 # Constrain the acceptable STARTTLS driver names
74 # to those that are supported in our source code
75 # set_property (CACHE STARTTLS_DRIVER PROPERTY STRINGS gnutls openssl mbedtls)
76 if (NOT STARTTLS_DRIVER)
78 set (STARTTLS_DRIVER gnutls CACHE STRING "Select the driving software for the STARTTLS feature")
81 if (NOT STARTTLS_DRIVER)
82 # For now, require a STARTTLS_DRIVER choice
83 # Later, consider using it to select available features (see PIOC_PING_V2)
84 message (FATAL_ERROR "You need _some_ driver for STARTTLS")
86 set_property (CACHE STARTTLS_DRIVER PROPERTY STRINGS gnutls)
88 # These are compile flags, not definitions, but it happens to work.
89 add_definitions(-fPIC -pthread)
91 add_definitions (-ggdb3 -O0)
93 # Pretend we looked for pthread libraries, so that we can write
94 # cmake code that looks consistent.
95 set(pthread_LIBRARIES pthread)
96 # Always include the TLSPool top-level include/ dir.
97 include_directories(${CMAKE_SOURCE_DIR}/include)
101 add_subdirectory(src)
102 add_subdirectory(lib)
103 add_subdirectory(tool)
104 add_subdirectory(pulleyback)
105 add_subdirectory(doc)
107 add_subdirectory(test)