Improvements in Python support and installation of Python and includes
[tlspool] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
2 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
3
4 project(tlspool C)
5
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"
10     TYPE REQUIRED
11     URL "https://github.com/arpa2/arpa2cm/"
12     PURPOSE "Required for the CMake build system for ${PROJECT}"
13 )
14 if (ARPA2CM_FOUND)
15     set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ARPA2CM_MODULE_PATH})
16 else()
17     feature_summary (WHAT ALL)
18     message (FATAL_ERROR "ARPA2CM is required.")
19 endif()
20
21 include(MacroEnsureOutOfSourceBuild)
22 include(MacroGitVersionInfo)
23
24 include(CTest)
25 include(FeatureSummary)
26 include(GNUInstallDirs)
27
28 set(CMAKE_C_STANDARD 99)
29 set(CMAKE_C_STANDARD_REQUIRED ON)
30
31 macro_ensure_out_of_source_build(
32     "Do not build TLSPool in the source directory.")
33 get_version_from_git(TLSPool 0.20)
34
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
39 #
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
51 # TODO: look for TLS-KDH
52
53 if(GnuTLSDane_FOUND)
54     add_definitions(-DHAVE_GNUTLS_DANE)
55 endif()
56
57
58 feature_summary(WHAT ALL VAR _features)
59 message(STATUS ${_features})
60
61 option(EXPERIMENTAL_SRP_SUPPORT "Enable support for SRP based on relative file names" OFF)
62 if (EXPERIMENTAL_SRP_SUPPORT)
63     add_definitions(-DEXPERIMENTAL_SRP)
64 endif()
65
66 # These are compile flags, not definitions, but it happens to work.
67 add_definitions(-fPIC -pthread)
68 # Pretend we looked for pthread libraries, so that we can write
69 # cmake code that looks consistent.
70 set(pthread_LIBRARIES pthread)
71 # Always include the TLSPool top-level include/ dir.
72 include_directories(${CMAKE_SOURCE_DIR}/include)
73
74 enable_testing()
75
76 add_subdirectory(src)
77 add_subdirectory(lib)
78 add_subdirectory(tool)
79 add_subdirectory(pulleyback)
80 add_subdirectory(doc)
81 if(BUILD_TESTING)
82     add_subdirectory(test)
83 endif()